Add problem 3 and 4 solutions done in  python