2024-04-26 06:59:08 发布
网友
如何使用Python处理科学记数法和执行计算? e、 克:
a='1e+03' b='1e+02'
如何求a和b的和,得到1.1+03的结果
是否需要使用浮子?我只是照原样用,打印出来1100.0
a = 1e+03 b = 1e+02 print(a+b)
如果你希望结果精确到1.1+03,这篇文章可能会很有帮助。 Display a decimal in scientific notation
c = '{0:0.2e}'.format(float(a)+float(b)) In[10]: c Out[10]: '1.10e+03'
Python的内置^{}支持科学记数法:
a = '1e+03' b = '1e+02' res = float(a) + float(b) # 1100.0 print int(res) # 1100
是否需要使用浮子?我只是照原样用,打印出来1100.0
如果你希望结果精确到1.1+03,这篇文章可能会很有帮助。 Display a decimal in scientific notation
Python的内置^{} 支持科学记数法:
相关问题 更多 >
编程相关推荐