while True:
a = input("Input a number: ")
if a.isdigit():
string_container += a + "\n"
add_container += int(a)
else:
if a == 'A':
print(Add_container)
else:
if a == 'T':
print(string_container)
else:
if a=="q":
os._exit(0)
else:
print("invalid input")
你应该把你的代码放在一个try-catch块中,就像这样。在
^{pr2}$
所以你必须
1. Select restart the kernel and clear output
2. Add try-catch so you can use "kernel interrupt" to kill the while loop
3. Whenever you finish using this while loop, select "kernel" -> "interrupt" to kill it completely
程序仍然处于“代码”模式。告诉我们通过ctrl+执行。在过去的三个星期里,我一直没有问题。在
我想我明白了。如果你这样写,那么你可以第一次运行它。但从第二次开始就不会执行了。因为jupyter只清除代码块输出,而不释放while循环。在
你应该把你的代码放在一个try-catch块中,就像这样。在
^{pr2}$所以你必须
希望有帮助
字符串容器=“” 添加容器=0 定义添加报告(整数加载):
总计=0
总计=总计+整数负载
#添加容器=0
^{pr2}$相关问题 更多 >
编程相关推荐