complete ex2.py