ICode国际青少年编程竞赛- Python-4级训练场-嵌套for循环入门
1、
for i in range(3):
Dev.step(3)
for j in range(3):
Dev.turnLeft()
Dev.step(-2)
Dev.turnLeft()
2、
for i in range(3):
Dev.turnLeft()
Dev.step(4)
Dev.turnRight()
Dev.step(2)
for i in range(4):
Dev.step(2)
Dev.turnRight()
3、
for i in range(4):
Dev.step(7)
for j in range(3):
Dev.turnLeft()
Dev.step(3)
4、
for j in range(4):
Dev.step(6)
for i in range(3):
Dev.turnRight()
Dev.step(3)
Dev.turnRight()
Dev.step(-3)
Dev.turnRight()
5、
for i in range(4):
for j in range(3):
Dev.step(-2)
Dev.turnRight()
Dev.step(-8)
6、
for i in range(3):
Dev.turnRight()
Spaceship.turnRight()
for j in range(3):
Dev.step(3)
Dev.step(-3)
Spaceship.step(2)
7、
for i in range(4):
Dev.step(3)
Dev.turnLeft()
for j in range(4):
Dev.step(2)
Dev.turnRight()
Dev.step(2)
Dev.turnRight()
Dev.step(-3)
Dev.turnRight()
8、
for i in range(3):
for j in range(2):
Dev.step(2)
Dev.turnLeft()
Dev.step(2)
Dev.turnRight()
9、
for i in range(4):
Dev.step(2)
for j in range(2):
Dev.step(2)
Dev.turnRight()
Dev.step(3)
Dev.step(-3)
Dev.turnLeft()
Dev.step(-6)
Dev.turnRight()
10、
for i in range(3):
Dev.step(5)
Dev.turnRight()
Dev.step(8)
for j in range(3):
Dev.turnRight()
Dev.step(3)
11、
for i in range(4):
Spaceship.step()
for j in range(3):
Spaceship.step(2)
Dev.step(2)
Dev.step(-2)
for k in range(2):
Spaceship.turnRight()
Spaceship.step(7)
Spaceship.turnLeft()
Dev.turnRight()
12、
for i in range(4):
Spaceship.turnLeft()
Dev.turnLeft()
for j in range(3):
Spaceship.step(2)
Dev.step(2)
Dev.step(-2)
13、
Dev.turnLeft()
for i in range(3):
Spaceship.step(4)
Dev.step()
for j in range(4):
Dev.step(2)
Dev.turnRight()
Dev.step(-1)
Spaceship.turnRight()
Spaceship.step(4)
Spaceship.turnLeft()
14、
for i in range(4):
for j in range(3):
Dev.step(3)
Dev.turnRight()
Dev.step(2)
Dev.step(-2)
Dev.turnLeft()
Dev.step(3)
Dev.turnRight()
15、
for i in range(3):
Spaceship.step(4)
Spaceship.turnRight()
for j in range(2):
Dev.step(3)
Dev.step(-3)
Spaceship.step(2)
Spaceship.turnLeft()
16、
for i in range(4):
for j in range(3):
Dev.step(2)
Dev.turnRight()
Dev.step(2)
Dev.turnLeft()
Dev.step(2)
Dev.turnRight()
17、
for i in range(3):
Dev.step(4)
Dev.turnRight()
for j in range(2):
Dev.step(2)
Dev.turnRight()
Dev.step()
Dev.step(-2)
Dev.step()
Dev.turnLeft()
Dev.step(2)
Dev.turnLeft()
18、
for i in range(4):
Spaceship.step()
for j in range(3):
Spaceship.step()
Spaceship.turnRight()
Spaceship.step(2)
Spaceship.turnLeft()
Spaceship.turnLeft()
19、
for i in range(3):
Spaceship.step()
for j in range(2):
Dev.step(2)
Dev.step(-3)
Dev.step(1)
Spaceship.step(2)
Spaceship.turnRight()
Spaceship.step(3)
Spaceship.turnLeft()
20、
for i in range(4):
Spaceship.step(2)
for j in range(2):
Dev.step(2)
Dev.turnLeft()
Dev.step(1)
Dev.step(-2)
Dev.step(1)
Dev.turnRight()
Dev.step(-4)
Spaceship.turnRight()
Spaceship.turnRight()
Spaceship.step(2)
Spaceship.turnRight()
Dev.turnLeft()