hw9 code refactored according to pep8