首页 > 代码库 > for循环和while循环

for循环和while循环

for循环和while循环

--道心

for循环

name1_list=[‘daoxin‘,‘wuxin‘,‘zhixin‘]
for ele in name1_list:

#找到“wuxin”,打印元素
if ele == "daoxin":
print("find")
continue
#找到“wuxin”,结束循环,打印元素

if ele == ‘wuxin‘ :
print("终于等到你")
break
else:
pass

 while循环

count=0
while (count<9):
print("the count is :",count)
count=count+1
print("Good bye")

 

for循环和while循环