Update Problem1.py

More efficient coding, by Assem guidance