以下代码遇到问题:
start_over = 1
question = input("Do you wish to try again? y/n: ")
if question == "y":
start_over -= 1
else:
raise SystemExit
如果他们输入
y
,则直接进入else
条件。
已解决,正在使用 input 而不是 raw_input
只需定义 start_over...就可以了
question = raw_input("Do you wish to try again? y/n: ")
start_over = 10
if question == "y":
start_over -= 1
print start_over
else:
raise SystemExit