16-嵌套 for
语法讲解 今天学: 循环语句 for / while for i in range(2): for j in range(2): print(i,j) 小练习 运行下面代码后输出是什么? f
15-while else
语法讲解 今天学: 循环语句 for / while i=0 while i<2: print(i) i+=1 else: print('done')
14-while + continue
语法讲解 今天学: 循环语句 for / while i=0 while i<4: i+=1 if i==2: continue print(i)
13-while + break
语法讲解 今天学: 循环语句 for / while i=0 while True: if i==2: break print(i) i+=1 小练习
12-while 累加
语法讲解 今天学: 循环语句 for / while i=1 s=0 while i<=3: s+=i i+=1 print(s) 小练习 运行下面代码后输出是什么? i
11-while 基础
语法讲解 今天学: 循环语句 for / while i=0 while i<3: print(i) i+=1 小练习 运行下面代码后输出是什么? i=0 while i
10-continue 跳过
语法讲解 今天学: 循环语句 for / while for i in range(5): if i%2==0: continue print(i) 小练习 运行下面代码后输出是什么? fo
09-break 终止
语法讲解 今天学: 循环语句 for / while for i in range(5): if i==3: break print(i) 小练习 运行下面代码后输出是什么? for i i
08-enumerate
语法讲解 今天学: 循环语句 for / while for i,x in enumerate([10,20]): print(i,x) 小练习 运行下面代码后输出是什么? for i,x in e
07-遍历列表
语法讲解 今天学: 循环语句 for / while for x in [1,2,3]: print(x*2) 小练习 运行下面代码后输出是什么? for x in [1,2,3]: print(x