Solve problems 5-7,9-10 using Python.