Codility Python Test