Python math.log10() Method
Example
Find the base-10 logarithm of different numbers
# Import math Library
import math
# Return the base-10 logarithm
of different numbers
print(math.log10(2.7183))
print(math.log10(2))
print(math.log10(1))
Try it Yourself »
Definition and Usage
The math.log10()
method returns the base-10 logarithm of a number.
Syntax
math.log10(x)
Parameter Values
Parameter | Description |
---|---|
x | Required. Specifies the value to calculate the logarithm for. If the value is 0 or a negative number, it returns a ValueError. If the value is not a number, it returns a TypeError |
Technical Details
Return Value: | A float value, representing the base-10
logarithm of a number |
---|---|
Python Version: | 2.3 |
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.