Update solution3.py

fixed a bug