modified answer5.py