hw4 in python