exercise 3

reformat to match PEP8 and add tests