while 循环
当while为true会一直继续 循环体
for 循环
这里for循环与c语言的不同,更加智能强大 for 目标 in 表达式: 循环体(一直取到没有)
range()
range([strat,] stop[,step=1]) 生成一个从strat到stop的数字列表(stop不包含),step可理解为公差
break
停止当前循环,跳出循环体
continue
中断本轮循环,并开始下一轮循环(循环开始之前,检测循环条件)
while 循环
当while为true会一直继续 循环体
for 循环
这里for循环与c语言的不同,更加智能强大 for 目标 in 表达式: 循环体(一直取到没有)
range()
range([strat,] stop[,step=1]) 生成一个从strat到stop的数字列表(stop不包含),step可理解为公差
break
停止当前循环,跳出循环体
continue
中断本轮循环,并开始下一轮循环(循环开始之前,检测循环条件)