【发布时间】:2016-12-20 03:10:28
【问题描述】:
问题就在标题中:如何跳转到 else 部分中 if 语句的开头?
代码:
p1 = int(input())
if p1 <= 9 and p1 >= 1:
pass
else:
print('Invalid input. Please try again.')
p1 = input()
【问题讨论】:
-
听起来你需要
loop? -
我通常在这种情况下使用循环。如果输入有效,则继续。其他循环。我不认为你可以像 c 中的 goto 那样在 python 中跳转语句
标签: python python-3.x python-3.2