要从变量“glory”中取1,变量需要是整数。当它变成一个整数时,我只会收到:“无法分配函数调用”。无法为函数调用或不支持操作数类型为 - =:'str'和'int'
import sys
glory = input("Glory charge: ")
glory_prev = glory
print(glory_prev)
pouch = 28
run_num = 0
nat_price = input("Nat price: ")
while True:
run = input("You've done " + (str(run_num)) + " runs: ")
if run == "a":
(int(glory) -= 1
pouch -= 1
if glory == 0:
print("New glory needed")
glory = glory_prev
if pouch == 0:
print("Repair pouch")
pouch = 28
elif run == "q":
sys.exit
else:
continue
请帮忙,谢谢。
你所期望的' (int(glory) - = 1'做什么? –
从荣耀中取出1 – FynFTW
int(glory)用参数glory调用函数int,它可能会返回一个整数然后你试图做一些像'10 - = 1',这没有任何意义 –