python for循环

 

格式:

for 变量 in 序列:
    执行的代码块

 

实例1:

fruits = ["apple", "banana", "cherry"]
for fruit in fruits:
    print(fruit)

 

 

 

 

 

 

 

posted @ 2023-08-23 20:15  天子骄龙  阅读(11)  评论(0编辑  收藏  举报