Solving CS50 problems in Python