Learn Python By Example – Mathematical Operations

Mathematical Operations Import the math module import math Display the value of pi. math.pi 3.141592653589793 Display the value of e. math.e 2.718281828459045 Sine, cosine, and tangent math.sin(2 * math.pi / 180) 0.03489949670250097 Exponent 2 ** 4, pow(2, 4) (16, 16) Absolute value abs(-20) 20 Summation sum((1, 2, 3, 4)) 10 Minimum min(3, 9, 10, 12) … Continue reading Learn Python By Example – Mathematical Operations