Python 不知道这里发生了什么,也不知道是怎么回事 whileui!=1或UI!=2: UI=int(输入(“按需付费Sim卡或无Sim卡(1/2)”) 如果UI==1: 全订单[1]=10 elif UI==2: 全订单[1]=11 订单号=1 x=0 如果UI>=0且UI
您将留在循环中,因为此条件始终得到验证:Python 不知道这里发生了什么,也不知道是怎么回事 whileui!=1或UI!=2: UI=int(输入(“按需付费Sim卡或无Sim卡(1/2)”) 如果UI==1: 全订单[1]=10 elif UI==2: 全订单[1]=11 订单号=1 x=0 如果UI>=0且UI,python,Python,您将留在循环中,因为此条件始终得到验证: while UI != 1 or UI != 2: UI = int(input("Pay as you go Sim or no SIM (1/2)")) if UI == 1: FullOrder[1] = 10 elif UI == 2: FullOrder[1] = 11 ordernumbers = 1 x=0 if UI >=0 and UI <3:
while UI != 1 or UI != 2:
UI = int(input("Pay as you go Sim or no SIM (1/2)"))
if UI == 1:
FullOrder[1] = 10
elif UI == 2:
FullOrder[1] = 11
ordernumbers = 1
x=0
if UI >=0 and UI <3:
while x <= ordernumbers:
print("your order currently is: ",Description[FullOrder[x]])
print("your order currently is: ",Price[FullOrder[x]])
x=x+1
实际上,UI总是不同于1或2
你应该做:
while UI != 1 or UI != 2:
这相当于:
while UI != 1 and UI != 2:
尝试如上所述更改while循环,使用UI=1初始化代码您的代码应该做什么?更改或添加代码。while后面的所有行都应该缩进。好老的DeMorgan<代码>如果用户界面不在(1,2)中,这将大大减少“混乱”
while not (UI == 1 or UI == 2):
while UI == 1 or UI == 2: