prob3 in python