Latest web development tutorials

Python log10 () function

Python figures Python figures


description

log10 () method returns the base 10 logarithm of x.


grammar

The following is the syntax log10 () method:

import math

math.log10( x )

Note: log10 () are not directly accessible, we need to import math module, invoke the method through static object.


parameter

  • x - numeric expression.

return value

Returns base 10 logarithm of x, x> 0.

Examples

The following shows an example of using log10 () method:

#!/usr/bin/python
import math   # 导入 math 模块

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)

After running the above example output is:

math.log10(100.12) :  2.00052084094
math.log10(100.72) :  2.0031157171
math.log10(119L) :  2.07554696139
math.log10(math.pi) :  0.497149872694

Python figures Python figures