for语句语法: for 目标 in 表达式: 循环体 例子1: favourite = 'Idmask' for i in favourite: print(i, end= ' ') 上面的输出结果为 I d m a s k 例子2: member = ['小甲鱼' ,'黑特' , '迷途' ,'小布丁'] for each in member: print(each, len(each)) 结果为: 小甲鱼 3 黑特 2 迷途 2 小布丁 3 range()函数 此函数为B…
1.for循环的使用,注意下面代码的区别 for i in range(0,10,2): print("i love you") for i in range(0,10): print("i love you") for i in range(5): print("i love you") 2.break与continue的区别 for i in range(5): if i == 2: break print(i) for i in range…