在python中,函数未在Else语句下执行时
也许这就是你想要的在python中,函数未在Else语句下执行时,python,if-statement,while-loop,Python,If Statement,While Loop,也许这就是你想要的 x=15 >>> if x==10: print ("not bad") elif x==11: print ("good") elif x==12: print ("best") else: while x==30: x+=1 print(x) x=15 >>>如果x==10: 打印(“不错”) elif x==11: 打印(“好”) elif x==12: 打印(“最佳”) 其他: 当x
x=15
>>> if x==10:
print ("not bad")
elif x==11:
print ("good")
elif x==12:
print ("best")
else:
while x==30:
x+=1
print(x)
x=15
>>>如果x==10:
打印(“不错”)
elif x==11:
打印(“好”)
elif x==12:
打印(“最佳”)
其他:
当x<30时:
x+=1
打印(x)
而x==30
永远都不是真的
。看起来像是打字错误,也许你想在x==30时编写
x=15
>>> if x==10:
print ("not bad")
elif x==11:
print ("good")
elif x==12:
print ("best")
else:
while x < 30:
x+=1
print(x)