Adding solution for exercise 1.b