Phương thức toán học Python.log10 ()
Thí dụ
Tìm logarit cơ số 10 của các số khác nhau
# 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))
Định nghĩa và Cách sử dụng
Phương math.log10()
thức trả về logarit cơ số 10 của một số.
Cú pháp
math.log10(x)
Giá trị tham số
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 |
Chi tiết kỹ thuật
Giá trị trả lại: | Một float giá trị, đại diện cho lôgarit cơ số 10 của một số |
---|---|
Phiên bản Python: | 2.3 |