Finished problem 002 in Python