Solove question 1 in python.