added python solution for problem 2
solved problem 3 in python