Updated pi.py with code