Update ChapQ1.5.py

Wrote a modulated version of solution