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")








posted @ 2020-01-14 20:28  i勤能补拙  阅读(4361)  评论(0编辑  收藏  举报