python 2nd 条件控制之for循环语句

时间:2021-08-30 12:21:40   收藏:0   阅读:29

案例1:

for i in range(1,6):
    print(i)
    print(‘The for loop is over‘)
#输出:
#1
#The for loop is over
#2
#The for loop is over

案例2:

for i in range(1,3):
    print(i)
else:    
    print(‘The for loop is over‘)
#输出:
#1 #2 #The for loop is over

 

原文:https://www.cnblogs.com/xsgg/p/15196579.html

评论(0)
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!