python --循环的break 和continue 的区别
2020-12-18 01:33
标签:while back his wrong this try style lang 代码 break代表结束本层循环,而continue则用于结束本次循环,直接进入下一次循环 break python --循环的break 和continue 的区别 标签:while back his wrong this try style lang 代码 原文地址:https://www.cnblogs.com/clairedandan/p/14097740.htmlcontinue
##打印1-10 除了7的数字
number=11
while number>1:
number -= 1
if number==7:
continue # 结束掉本次循环,即本次循环continue之后的代码都不会运行了,而是直接进入下一次循环
print(number)username="zhansean"
password="19911005"
int_username=input("please input your name:")
int_password=input("please input your password:")
count = 0
while count :
if int_username=="zhangsan" and int_password=="19931005":
print("gongratulations! you can login")
break
else:
print("sorry! the password is wrong or has no this user")
count+=1
print("sorry ,you have login above three times ,please try again after 3 minutes")
上一篇:理解C#中的闭包
文章标题:python --循环的break 和continue 的区别
文章链接:http://soscw.com/essay/36972.html