def choose():
decision = input( 'Do you ' + colored('run', ('blue')) + ' or ' +
colored('attack?', ('blue')) )
return decision
while choose():
if choose() == "attack":
etc.
elif choose() == "run":
etc.
答案 0 :(得分:0)
只调用一次输入例程并保存响应。 重复检查保存的值,而不是每次都返回给您的用户。
choice = choose()
while choice:
if choice == "attack":
etc.
elif choice == "run":
etc.
...
choice = choose()