Latest web development tutorials

Python3 log10 () function

Python3 digital Python3 digital


description

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


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/python3
import math   # 导入 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))

After running the above example output is:

math.log10(100.12) :  2.0005208409361854
math.log10(100.72) :  2.003115717099806
math.log10(119) :  2.075546961392531
math.log10(math.pi) :  0.4971498726941338

Python3 digital Python3 digital