简体   繁体   中英

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

what the title says

when i try to input a number in the form of a scientific notation like 1*10**12 in this code:

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

I get this error

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

Just enter "1e22" and convert it with float. "1e22" is python notation for 1x10^22.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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