Mat*_*ker 3 python input python-2.7
以下代码有问题:
start_over = 1
question = input("Do you wish to try again? y/n: ")
if question == "y":
start_over -= 1
else:
raise SystemExit
Run Code Online (Sandbox Code Playgroud)
如果他们进入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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
54154 次 |
| 最近记录: |