problem 10 working code
passing tests for problem 10