The math.log10() function is used to calculate the base-10 logarithm of a number.

Syntax:
math.log10(x)
copy

Where,  x  is the number whose base-10 logarithm we want to calculate.
The function returns the logarithm of x to base 10.

ExampleEdit & Run
import math 

print(math.log10(10))
print(math.log10(50))
print(math.log10(100))
print(math.log10(200))
print(math.log10(1000))
copy
Output:
1.0 1.6989700043360187 2.0 2.3010299956639813 3.0 [Finished in 0.01219712570309639s]

The math.log10() function is a shorthand for math.log() function with 10 as the base i.e math.log(x, 10)

ExampleEdit & Run
import math

print(math.log10(100))
print(math.log(100, 10))
copy
Output:
2.0 2.0 [Finished in 0.011464324779808521s]

The function raises a ValueError if the value of is negative.

ExampleEdit & Run
import math

math.log10(-1)
copy
Output:
Traceback (most recent call last):   File "<string>", line 3, in <module> ValueError: math domain error [Finished in 0.010170696768909693s]