ICode国际青少年编程竞赛- Python-2级训练场-range函数
1、
for i in range(4):
Dev.turnLeft()
Dev.step(i + 1)
2、
for i in range(4):
Spaceship.step(i + 1)
Spaceship.turnRight()
3、
for i in range(4):
Spaceship.step(i + 1)
Dev.step(2)
Dev.step(-2)
4、
for i in range(1, 5):
Spaceship.step(2)
Dev.step(i)
Dev.step(-i)
5、
for i in range(1, 4):
Dev.step(i)
Dev.turnLeft()
Dev.step(i)
Dev.turnRight()
6、
for i in range(1, 5):
Dev.step(i)
Dev.step(-2 * i)
Dev.step(i)
Spaceship.step(2)
7、
Dev.step(1)
for i in range(3):
Spaceship.step(i + 1)
Dev.step(i + 1)
Dev.step(-i - 1)
8、
for i in range(1, 5):
Spaceship.step(i)
Dev.step(i)
Dev.step(-i)
Spaceship.turnLeft()
Dev.turnLeft()
9、
for i in range(2, 5):
Dev.step(i)
Dev.turnLeft()
Spaceship.step(i)
Spaceship.turnRight()
Spaceship.step(i)
Spaceship.turnLeft()
Dev.step(i)
Dev.turnRight()
10、
for i in range(2):
Spaceship.step(2)
Spaceship.turnLeft()
for i in range(4):
Spaceship.step(2)
Dev.step(1)
Dev.step(-2)
Dev.step(1)
Dev.turnRight()
Spaceship.step(2)
Spaceship.turnLeft()
Spaceship.step(3)
11、
for i in range(1, 10, 2):
Dev.step(i)
Dev.turnLeft()
12、
for i in range(1, 8, 2):
Spaceship.step(2)
Dev.step(i)
Dev.step(-i)
13、
for i in range(1, 6, 2):
Dev.step(i + 1)
Dev.turnRight()
Dev.step(i)
Dev.step(-i)
Dev.turnLeft()
Dev.step(-i - 1)
Spaceship.step(5)
14、
for i in range(1, 8, 2):
Spaceship.step(i)
Dev.step(2)
Dev.step(-2)
Dev.turnRight()
Spaceship.turnRight()
Spaceship.turnRight()
Spaceship.step(i)
Spaceship.turnLeft()
15、
for i in range(0, 7, 2):
Spaceship.step(i)
Spaceship.turnRight()
Dev.step(i + 2)
Dev.step(-i - 2)
Dev.turnRight()
16、
for i in range(1, 8, 2):
Dev.step(2)
Dev.turnLeft()
Dev.step(i)
Dev.step(-2 * i)
Dev.step(i)
Dev.turnRight()
17、
for i in range(0, 5, 2):
Spaceship.step(i)
Dev.step(i + 2)
Dev.step(-2 * (i + 2))
Dev.step(i + 2)
18、
for i in range(1,6,2):
Dev.step(i)
Dev.turnLeft()
Dev.step(3)
Dev.turnRight()
for i in range(2,7,2):
Spaceship.step(i)
Spaceship.turnLeft()
Spaceship.step()
Spaceship.turnRight()
19、
for i in range(1, 8, 2):
Dev.step(1)
Dev.step(-1)
Spaceship.step(2)
Dev.step(-i)
Dev.step(i)
Spaceship.step(2)
Spaceship.turnRight()
Spaceship.step(8)
Spaceship.turnRight()
Spaceship.turnRight()
Dev.turnLeft()
20、
for i in range(1, 6, 2):
Dev.step(i)
Dev.turnRight()
Dev.step(i)
Dev.turnLeft()
Dev.step(-1)
for i in range(1, 6, 2):
Spaceship.step(i)
Spaceship.turnRight()
Spaceship.step(2)
Spaceship.turnLeft()
for i in range(6, 9):
Dev.turnRight()
Dev.step(-i)