created functions for question 2 and 3, created test for question 2

test does not pass