The log10() method in Python number returns the base-10 logarithm of x for the values of x > 0. The Python log10 function is yet another function of Python Math \responsible for calculating the logarithmic value of a specific number with base 10. When compared to math.log(x, 10) the Python log10 function comes out to be more accurate.
Following is the syntax for log10() method:
import math math.log10( x )
Note - This function is not accessible directly, so we need to import the math module, and then we need to call this function using a math static object.
x - This is a numeric expression.
This method returns base-10 logarithm of x for x > 0.
The following example shows the usage of log10() metho
#!/usr/bin/python import math # This will import math module print "math.log10(100.12) : ", math.log10(100.12) print "math.log10(100.72) : ", math.log10(100.72) print "math.log10(119L) : ", math.log10(119L) print "math.log10(math.pi) : ", math.log10(math.pi)
When we run the above program, it produces the following result:
math.log10(100.12) : 2.00052084094 math.log10(100.72) : 2.0031157171 math.log10(119L) : 2.07554696139 math.log10(math.pi) : 0.497149872694
Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.