Codility Coin Adjacency Solution Python