Python (TypeError:';float';对象不可调用)进行数学运算时
我正在写一个代码来计算一个电子在玻尔模型中跃迁到不同轨道能级时的所有能级。我写了一些数学,但当我尝试运行它时,它会说TypeError:“float”对象是不可调用的。我需要做什么 这是我的密码:Python (TypeError:';float';对象不可调用)进行数学运算时,python,callable,Python,Callable,我正在写一个代码来计算一个电子在玻尔模型中跃迁到不同轨道能级时的所有能级。我写了一些数学,但当我尝试运行它时,它会说TypeError:“float”对象是不可调用的。我需要做什么 这是我的密码: loopone = True if (work == Element_symbols[0]): energy = ((charge[0]*(0-13.6))/1) print ('This is the energy level for the electron at the N=1 state.')
loopone = True
if (work == Element_symbols[0]):
energy = ((charge[0]*(0-13.6))/1)
print ('This is the energy level for the electron at the N=1 state.')
print (energy)
print ('These are all of the possible energies from the n=6 level')
nrgone = (-13.6((1/(5*5)-(1/(6*6)))))
nrgtwo = (-13.6((1/(4*4)-(1/(6*6)))))
nrgthree = (-13.6((1/(3*3)-(1/(6*6)))))
nrgfour = (-13.6((1/(2*2)-(1/(6*6)))))
nrgfive = (-13.6((1/(1*1)-(1/(6*6)))))
Energies = (nrgone, nrgtwo, nrgthree, nrgfour, nrgfive)
print (Energies)
loopone = False
我相信你的问题就在这里
nrgone = (-13.6((1/(5*5)-(1/(6*6)))))
你的意思是(注意乘法符号)吗
您在每行
nrgone=(-13.6((1/(5*5)-(1/(6*6-))
中缺少一个运算符(可能是*
),谢谢。我错过了,不客气。如果答案解决了你的问题,请考虑点击它旁边的复选标记来接受它。
nrgone = (-13.6*((1/(5*5)-(1/(6*6)))))