如何编写指数表示
python 187
原文标题 :How to write exponential representation
我想知道如何在python中将等效表示写为以下数字:
-3.3999999521443642e+38
我做了以下事情:
print(-3.3999999521443642*math.exp(38))
这是正确的吗?
回复
我来回复-
leosh 评论
该回答已被采纳!
正如您在问题中所说的那样,Python 支持科学记数法,数字中带有
e
:>>> a=-3.3999999521443642e+38 >>> print(a) -3.3999999521443642e+38 >>> type(a) <class 'float'>
2年前 -
balu 评论
你可以按原样使用
a = -3.3999999521443642e+38 print(a)
输出-3.3999999521443642e+38
2年前 -
Abdallah Ibrahim 评论
Python 直接理解这种表示。
x = 44e10 print (x) 440000000000.0
这只是一种以紧凑方式表示大数字的优雅方式。
2年前