ICode国际青少年编程竞赛- Python-2级训练场-range函数
1、
python
for i in range(4):
Dev.turnLeft()
Dev.step(i + 1)
2、
python
for i in range(4):
Spaceship.step(i + 1)
Spaceship.turnRight()
3、
python
for i in range(4):
Spaceship.step(i + 1)
Dev.step(2)
Dev.step(-2)
4、
python
for i in range(1, 5):
Spaceship.step(2)
Dev.step(i)
Dev.step(-i)
5、
python
for i in range(1, 4):
Dev.step(i)
Dev.turnLeft()
Dev.step(i)
Dev.turnRight()
6、
python
for i in range(1, 5):
Dev.step(i)
Dev.step(-2 * i)
Dev.step(i)
Spaceship.step(2)
7、
python
Dev.step(1)
for i in range(3):
Spaceship.step(i + 1)
Dev.step(i + 1)
Dev.step(-i - 1)
8、
python
for i in range(1, 5):
Spaceship.step(i)
Dev.step(i)
Dev.step(-i)
Spaceship.turnLeft()
Dev.turnLeft()
9、
python
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、
python
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、
python
for i in range(1, 10, 2):
Dev.step(i)
Dev.turnLeft()
12、
python
for i in range(1, 8, 2):
Spaceship.step(2)
Dev.step(i)
Dev.step(-i)
13、
python
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、
python
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、
python
for i in range(0, 7, 2):
Spaceship.step(i)
Spaceship.turnRight()
Dev.step(i + 2)
Dev.step(-i - 2)
Dev.turnRight()
16、
python
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、
python
for i in range(0, 5, 2):
Spaceship.step(i)
Dev.step(i + 2)
Dev.step(-2 * (i + 2))
Dev.step(i + 2)
18、
python
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、
python
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、
python
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)