Programming challenges : Solved in Python