mathモジュールを使います
import math a = math.exp(1) b = math.exp(2) c = math.exp(-1) print("e = {}".format(a)) print("e**2 = {}".format(b)) print("e**(-1) = {}".format(c))
[vagrant@localhost python]$ python app.py
e = 2.718281828459045
e**2 = 7.38905609893065
e**(-1) = 0.36787944117144233
import math x = math.e y = len(str(math.e)) - 1 print("e = {}".format(x)) print("桁数 {}".format(y))
[vagrant@localhost python]$ python app.py
e = 2.718281828459045
桁数 16