modified ex1.py