Python inbuilt Functions 11

e

This is an inbuilt constant that outputs the value of e(2.718281).

import math

print("e value")
print(math.e)
#Output:
e value
2.718281828459045

exp(a)

This function returns the value of e raised to the power a (e**a) .

import math

print("exp value")
print(math.exp(2))
#Output:

exp value
7.38905609893065

gcd()

This function is used to compute the greatest common divisor of 2 numbers mentioned in its arguments. This function works in python 3.5 and above.

import math

print("gcd function")
a=15
b=5
print(math.gcd(a,b))
a=100
b=15
print(math.gcd(a,b))
#Output:
gcd function
5
5

Visitor Counter

0051032