Easy Tutorial
❮ Python Os Fsync Python Fibonacci Recursion ❯

Python3 log10() Function

Python3 Numbers


Description

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


Syntax

Here is the syntax for the log10() method:

import math

math.log10(x)

Note: log10() cannot be accessed directly; it requires importing the math module and calling this method via the static object.


Parameters


Return Value


Example

The following example demonstrates the use of the log10() method:

#!/usr/bin/python3
import math   # Import the math module

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))

The output of the above example 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 Numbers

❮ Python Os Fsync Python Fibonacci Recursion ❯