Easy Tutorial
❮ Ref Math Ceil Python Fibonacci Sequence ❯

Python math.log10() Method

Python math Module

The math.log10(x) method in Python returns the base-10 logarithm of x.

Syntax

The syntax for the math.log10() method is as follows:

math.log10(x)

Parameter Description:

Return Value

Returns a floating-point number, representing the natural logarithm of a number to the base 10.

Example

The following example returns the natural logarithm of a number to the base 10:

Example

# Import math package
import math

# Output the natural logarithm of a number to the base 10
print(math.log10(2.7183))
print(math.log10(2))
print(math.log10(1))

Output result:

0.43429738512450866
0.3010299956639812
0.0

Python math Module

❮ Ref Math Ceil Python Fibonacci Sequence ❯