weight=input("请输入带单位符号的体重(如:58kg):")
up=0.5
for i in range(10):
weight=eval(weight[0:-2])+up
moon=weight*0.165
print("未来十年你在地球上的体重是:{:.2f}kg,在月球上的体重是:{:.2f}.".format(weight,moon))
提示
Traceback (most recent call last):
File "D:\python\程序调试题(weight).py", line 4, in <module>
weight=eval(weight[0:-2])+up
TypeError: 'float' object is not subscriptable
不知道要怎么修改