exercise 2 from semester 1