繁体   English   中英

有没有办法输入像 1*10**2 这样的东西?

[英]Is there a way to input something like 1*10**2?

标题说的是什么

当我尝试在此代码中以科学记数法(如 1*10**12)的形式输入数字时:

h = float(input.('enter the value of [H+]: '))

我收到这个错误

h = float(input('enter the value of [H+]: '))
ValueError: could not convert string to float: '1*10**12'

只需输入“1e22”并将其转换为浮点数。 “1e22”是 1x10^22 的 Python 符号。

标准语法是使用 little e来表示具有 10 次幂的浮点文字,例如1e2在浮点表示中是1*(10**2)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM