COJ challengues solved in python