Calculate Euler Number in Python