变量a可以采用任意数量的值.值a是为while循环提供的额外预定义条件的数量.
这可以通过多个elif语句来完成,但有更简洁的方法吗?
if a == 0:
while condition_1:
...
elif a == 1:
while condition_1 or condition_2:
...
elif a == 2:
while condition_1 or condition_2 or condition_3:
...
Run Code Online (Sandbox Code Playgroud)