3

遇到以下代码问题:

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

4

1 回答 1

5

只需定义 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
于 2013-09-27T15:55:00.723 回答