Computer >> Computer tutorials >  >> Programming >> Python

How to calculate natural log of a number in Python?


In the math module, two functions for calculation of logarithmic value are defined. The log() function returns natural logarithm of a number, whereas log10() calculates the standard loarithm i.e. to the base 10

The log() function takes two arguments, the number and base

import math
print ("math.log(100.12) : ", math.log(100.12))
print ("math.log(100.72) : ", math.log(100.72))
print ("math.log(math.pi) : ", math.log(math.pi))