资源简介 (共14张PPT)列表的遍历作业解析Dev.step(2)Dev.turnRight()Dev.step(4)Dev.step(-2)Spaceship.step(2)Dev.turnLeft()Dev.step(2)Dev.turnLeft()Dev.step(2)Ex-5作业解析for i in range(3):Dev.turnLeft()Dev.step(2)Dev.turnRight()Dev.step(2)Ex-8作业解析Dev.turnLeft()for i in range(3):Spaceship.step(2)Dev.step(2)Dev.step(-3)Dev.step(1)Spaceship.step(1)Spaceship.turnLeft()Spaceship.step(2)Spaceship.turnRight()Ex-11作业解析for i in range(4):Spaceship.step(3)Dev.step(2)Dev.step(-2)Spaceship.turnRight()Spaceship.step(1)Dev.turnRight()Dev.step(2)Dev.step(-2)Spaceship.turnLeft()Spaceship.step(4)Spaceship.turnRight()Spaceship.step(3)Ex-14进行4次循环讲授新课Flyer[0]Flyer[1]Flyer[6]多个飞板都叫Flyer,Flyer就是一个列表,例如Flyer[0]、Flyer[1],其中0和1就是索引值,可以理解为编号,通过编号可以找到对应的飞板通过for循环可以遍历,即从头到尾依次从列表中获取所有的飞板,用变量i来表示Flyer的索引值for i in range(7):Flyer[i].step(1)Dev.step(8)讲授新课Flyer[0]Flyer[1]Flyer[2]Flyer[7]Flyer[6]for i in range(8):Flyer[i].step(3)for j in range(4):Dev.turnLeft()Dev.step(3)Dev.step(-6)Dev.step(3)Dev.turnRight()Dev.step(4)使用变量i索引所有飞盘Dev行走路线的规律基础训练2 Ex-7讲授新知for循环中变量i可以做加减乘除运算,例如这一题中,只有索引值为0-2-4的飞板需要移动,变化可以用(i*2)表示for i in range(3):Flyer[i*2].step(1)Dev.turnRight()Dev.step(9)Flyer[0]Flyer[2]Flyer[4]课堂练习当飞板的移动步数出现变化时,可以应用变量表示飞板的移动步数请把下面的代码,补充完整,完成收集任务a=8for i in range(4):Flyer[i].step(a)a=a/2Dev.step(8)Flyer[0]Flyer[3]课堂练习基础训练2 Ex-10Flyer[0]Flyer[1]Flyer[2]Flyer[3]for i in range(4):Flyer[i].step(1)for i in range(6):if i%2==0:Dev.turnRight()if i%2==1:Dev.turnLeft()Dev.step(2)课堂练习for i in range(3):Flyer[i].step(i+1)Dev.step(6)Flyer[0]Flyer[1]Flyer[2]课堂练习for i in range(4):Flyer[i].step(2)Dev.step(2)Dev.turnLeft()Dev.step(2)Dev.turnRight()Dev.step(3)Dev.turnLeft()Dev.step(1)Dev.turnRight()Dev.step(1)练习巩固完成训练20~30题课后作业完成第30~40题。要求:周日晚8点前,将“我的成绩”截图上传至编程园地scls-one.ysepan.com。 展开更多...... 收起↑ 资源预览