Python Tutorial Python Advanced Python References Python Libraries

Python math - log10() Function



The Python math.log10() function returns the base-10 logarithm of a given number.

Syntax

math.log10(x)

Parameters

x Required. Specify the number.

Return Value

Returns the base-10 logarithm of a given number.

Example:

In the example below, log10() function is used to calculate the base-10 logarithm of a given number.

import math

print(math.log10(10))
print(math.log10(50))
print(math.log10(100))

The output of the above code will be:

1.0
1.6989700043360187
2.0

❮ Python Math Module