added solution to problem 3 with python