我试图创建以下内容,以便在我去的时候重新分配变量。
def train(old_strength, old_energy):
train = input("What would you like to do now?\n'strentgh' or 'rest'\n>")
if train == 'strength':
strength = old_strength+10
energy = old_energy-10
if energy <= 0:
print ("You do not have enough energy to do this.")
else:
pass
print ("You have gained 10 strength, and now have %d strength and %d energy left" %(strength, energy))
old_strength = strength)
old_energy = energy)
train(old_strength, old_energy)
我试图得到它,以便当它回到“训练”输入时,它将在下一次使用新的力量和能量值。目前我收到错误
Traceback (most recent call last):
File "settler.py", line 127, in <modul
train(10, 50)
File "settler.py", line 37, in train
train(old_strength, old_energy)
TypeError: 'str' object is not callable
我该如何解决?提前谢谢了