Added Problem 3 in Python