To solve problem on python challenge