solutions of python homework 5