python while中使用else语句
'''
while 表达式:
语句1
else:
语句2
逻辑:在条件语句(表达式)为False时执行else中的“语句2”
'''
a = 1
while a <= 3:
print("sunck is a good man!")
a += 1
else:
print("very very good")
print("you are right")
'''
while 表达式:
语句1
else:
语句2
逻辑:在条件语句(表达式)为False时执行else中的“语句2”
'''
a = 1
while a <= 3:
print("sunck is a good man!")
a += 1
else:
print("very very good")
print("you are right")