Python3 log10()函數(shù)簡單用法
更新時間:2019年02月19日 15:19:27 投稿:laozhang
在本文中我們給大家整理了關(guān)于Python3中l(wèi)og10()函數(shù)的基本用法和相關(guān)知識點,需要的可以學(xué)習(xí)下。
描述
log10() 方法返回以10為基數(shù)的x對數(shù),x>0。
語法
以下是 log10() 方法的語法:
import math math.log10( x )
注意:log10()是不能直接訪問的,需要導(dǎo)入 math 模塊,通過靜態(tài)對象調(diào)用該方法。
參數(shù)
x -- 數(shù)值表達(dá)式。
返回值
返回以10為基數(shù)的x對數(shù),x>0。
實例
以下展示了使用 log10() 方法的實例:
#!/usr/bin/python3 import math # 導(dǎo)入 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))
以上實例運行后輸出結(jié)果為:
math.log10(100.12) : 2.0005208409361854 math.log10(100.72) : 2.003115717099806 math.log10(119) : 2.075546961392531 math.log10(math.pi) : 0.4971498726941338
相關(guān)文章
Pandas 處理DataFrame中的inf值實現(xiàn)
Inf 表示正無窮大或負(fù)無窮大,通常是在數(shù)學(xué)計算中產(chǎn)生的結(jié)果,本文主要介紹了Pandas 處理DataFrame中的inf值實現(xiàn),具有一定的參考價值,感興趣的可以了解一下2024-04-04基于Python制作一個端午節(jié)相關(guān)的小游戲
端午節(jié)快樂,今天我將為大家?guī)硪黄嘘P(guān)端午節(jié)的編程文章,希望能夠為大家獻(xiàn)上一份小小的驚喜,我們將會使用Python來實現(xiàn)一個與端午粽子相關(guān)的小應(yīng)用程序,在本文中,我將會介紹如何用Python代碼制做一個“粽子拆解器”,感興趣的小伙伴歡迎閱讀2023-06-06