Create ex2.py

Exercise 2 from LPTHW