Python Math log10() Method
The Python Math log10() method returns the logarithm of x in base 10, with x > 0.
Python Math log10() Syntax
Here is the syntax of the log10() method:
import math
math.log10( x )
Note: log10() is not directly accessible, you need to import the math module and call the method through a static object.
Python Math log10() Parameters
- x – The numeric expression.
Python Math log10() Return Value
Returns the logarithm of x in base 10 with x > 0.
Python Math log10() Example#1
The following shows an example of using the log10() method.
#!/usr/bin/python3
import math
print ("math.log10(100.12) : ", math.log10(100.12))
print ("math.log10(100.72) : ", math.log10(100.72))
print ("math.log10(119) : ", math.log10(119))
print ("math.log10(math.pi) : ", math.log10(math.pi))
Output: