Solved example 7.7
Applied PEP8 to example 7.6