code ex2.py