Python – Find Base-10 Logarithm – log10() Function with Examples

log10() function is used to find the the base-10 logarithm of x in Python for the given input(x – parameter).

 

Syntax of log10() Function

The syntax of log10() function in Python is:

math.log10(x)

 

Parameters of log10() Function in Python

x – Where x is any valid python number (positive or negative). This parameter is required.
Note: If the x parameter is not a number, log10() function will return an Error.

 

Compatibility

log10() function is available and compatible with both Python 2.x and 3.x. This function is a part of python standard math library.

 

Return Value of log10() Function in Python

log10() function returns the base-10 logarithm of x for the given input.

 

Python log10() Function Example

# import math library
import math
print(math.log10(-0.2))
print(math.log10(0))
print(math.log10(0.2))
print(math.log10(77))
print(math.log10(-3677))

Output: