ex12.py modified