Latest web development tutorials

Python3 log10 () ฟังก์ชัน

Python3 ดิจิตอล Python3 ดิจิตอล


ลักษณะ

log10 () วิธีการส่งกลับฐาน 10 ลอการิทึม x, x> 0


ไวยากรณ์

ต่อไปนี้เป็นไวยากรณ์ log10 () วิธีการ:

import math

math.log10( x )

หมายเหตุ: log10 () จะไม่สามารถเข้าถึงได้โดยตรงเราจำเป็นต้องนำเข้าโมดูลคณิตศาสตร์เรียกวิธีการผ่านวัตถุแบบคงที่


พารามิเตอร์

  • X - นิพจน์ตัวเลข

ราคาย้อนกลับ

ผลตอบแทน 10 ฐานลอการิทึม x, x> 0

ตัวอย่าง

ต่อไปนี้จะแสดงให้เห็นตัวอย่างของการใช้ log10 () วิธีการต่อไปนี้:

#!/usr/bin/python3
import math   # 导入 math 模块

print ("math.log10(100.12) : ", math.log10(100.12))
print ("math.log10(100.72) : ", math.log10(100.72))
print ("math.log10(119) : ", math.log10(119))
print ("math.log10(math.pi) : ", math.log10(math.pi))

หลังจากทำงานเอาท์พุทตัวอย่างข้างต้นคือ

math.log10(100.12) :  2.0005208409361854
math.log10(100.72) :  2.003115717099806
math.log10(119) :  2.075546961392531
math.log10(math.pi) :  0.4971498726941338

Python3 ดิจิตอล Python3 ดิจิตอล