資訊內(nèi)容
python e怎么表示
python e的表示方法:使用【exp()】方法,代碼為【import math;math.exp( x );】,【exp()】是不能直接訪問的,需要導(dǎo)入math模塊,通過(guò)靜態(tài)對(duì)象調(diào)用該方法。a7H少兒編程網(wǎng)-https://www.pxcodes.com
a7H少兒編程網(wǎng)-https://www.pxcodes.com
本教程操作環(huán)境:windows7系統(tǒng)、python3.9版,DELL G3電腦。a7H少兒編程網(wǎng)-https://www.pxcodes.com
python e的表示方法:a7H少兒編程網(wǎng)-https://www.pxcodes.com
exp()方法返回x的指數(shù),ex。a7H少兒編程網(wǎng)-https://www.pxcodes.com
語(yǔ)法a7H少兒編程網(wǎng)-https://www.pxcodes.com
以下是 exp() 方法的語(yǔ)法:a7H少兒編程網(wǎng)-https://www.pxcodes.com
import math math.exp( x )注意:exp()是不能直接訪問的,需要導(dǎo)入 math 模塊,通過(guò)靜態(tài)對(duì)象調(diào)用該方法。a7H少兒編程網(wǎng)-https://www.pxcodes.com
參數(shù)a7H少兒編程網(wǎng)-https://www.pxcodes.com
x -- 數(shù)值表達(dá)式。a7H少兒編程網(wǎng)-https://www.pxcodes.com
返回值a7H少兒編程網(wǎng)-https://www.pxcodes.com
返回x的指數(shù),ex。a7H少兒編程網(wǎng)-https://www.pxcodes.com
實(shí)例a7H少兒編程網(wǎng)-https://www.pxcodes.com
以下展示了使用 exp() 方法的實(shí)例:a7H少兒編程網(wǎng)-https://www.pxcodes.com
#!/usr/bin/python import math # 導(dǎo)入 math 模塊 print "math.exp(-45.17) : ", math.exp(-45.17) print "math.exp(100.12) : ", math.exp(100.12) print "math.exp(100.72) : ", math.exp(100.72) print "math.exp(119L) : ", math.exp(119L) print "math.exp(math.pi) : ", math.exp(math.pi)以上實(shí)例運(yùn)行后輸出結(jié)果為:a7H少兒編程網(wǎng)-https://www.pxcodes.com
math.exp(-45.17) : 2.41500621326e-20 math.exp(100.12) : 3.03084361407e+43 math.exp(100.72) : 5.52255713025e+43 math.exp(119L) : 4.7978133273e+51 math.exp(math.pi) : 23.1406926328相關(guān)免費(fèi)學(xué)習(xí)推薦:python視頻教程a7H少兒編程網(wǎng)-https://www.pxcodes.com
以上就是python e怎么表示的詳細(xì)內(nèi)容,更多請(qǐng)關(guān)注少兒編程網(wǎng)其它相關(guān)文章!a7H少兒編程網(wǎng)-https://www.pxcodes.com

- 上一篇
python如何保留小數(shù)點(diǎn)位數(shù)
簡(jiǎn)介python保留小數(shù)點(diǎn)位數(shù)的方法:首先新建py文件,輸入【a=('%.2f'%a)】即可保留2位小數(shù);然后如果輸入【a=('%.4f'%a)】,就保留4位小數(shù);最后也可以輸入【a=format(a,'.2f')】來(lái)保留小數(shù)點(diǎn)位數(shù)。本教程操作環(huán)境:win
- 下一篇
python如何判斷字符串是否為整數(shù)
簡(jiǎn)介python判斷字符串是否為整數(shù)的方法:首先可以根據(jù)字符串的第一個(gè)字符確定整數(shù)的正負(fù);然后對(duì)字符串從右向左遍歷,例如111,可以看成【11*10+1】,而11又可以看成【1*10+1】。本教程操作環(huán)境:windows7系統(tǒng)、python3.9版,DELLG3電腦。python判斷字符串是否為整數(shù)的方