Python Math log() Method
The log() method returns the natural logarithm of x, with x > 0.
Python Math log() Syntax
Here is the syntax of the log() method:
import math
math.log( x )
Note: log() is not directly accessible, you need to import the math module and call the method through a static object.
Python Math log() Parameters
- x – The numeric expression.
Python Math log() Return Value
Returns the natural logarithm of x, x > 0.
Python Math log() Example#1
The following shows an example of using the log() method.
#!/usr/bin/python3
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))
Output: