Update hw6.py

Solved problem 3