exercise 3 from semester 1