ICode国际青少年编程竞赛- Python-1级训练场-for循环与变量
1、
python">a = 1
for i in range(4):Spaceship.step(a)Dev.step(2)Dev.step(-2)a = a + 1
2、
python">a = 1
for i in range(4):Spaceship.step(a)Dev.step(3)Dev.step(-3)a = a + 1
3、
python">a = 1
for i in range(4):Dev.turnLeft()Dev.step(a)a = a + 1
4、
python">a = 5
for i in range(5):Dev.step(a)Dev.turnRight()a = a - 1
5、
python">a = 5
for i in range(4):Spaceship.step(a)Spaceship.turnLeft()a = a - 1
6、
python">a = 6
for i in range(5):Spaceship.step(a)Spaceship.turnRight()a = a - 1
7、
python">a = 1
for i in range(3):Dev.step(a)Dev.turnLeft()Dev.step(a)Dev.turnRight()a = a + 1
8、
python">a = 2
for i in range(3):Dev.step(a)Dev.turnRight()Dev.step(a)Dev.turnLeft()a = a + 1
9、
python">a = 1
for i in range(6):Dev.step(a)Dev.turnRight()a = a + 2
10、
python">a = 2
for i in range(3):Dev.step(a)Dev.turnRight()Dev.step(4)Dev.step(-4)Dev.turnLeft()a = a + 2
11、
python">a = 1
for i in range(3):Dev.step(a)Dev.turnRight()Dev.step(2)Dev.step(-4)Dev.step(2)Dev.turnLeft()a = a + 1
12、
python">a = 13
for i in range(5):Dev.turnLeft()Dev.step(a)a = a - 3
13、
python">a = 3
for i in range(4):Spaceship.step(a)Spaceship.turnRight()Spaceship.turnRight()Spaceship.step(a)Spaceship.turnRight()a = a + 1
14、
python">a = 1
for i in range(3):Dev.turnRight()Dev.step(a)Dev.turnLeft()Dev.step(a)a = a + 2
15、
python">a = 1
for i in range(4):Dev.step(a)Dev.turnRight()a = a * 2
16、
python">a = 1
for i in range(4):Dev.step(a)Dev.turnLeft()a = a * 2
17、
python">a = 8
for i in range(4):Dev.step(a)Dev.turnRight()a = a / 2
18、
python">a = 12
for i in range(3):Dev.step(a)Dev.turnRight()a = a / 2
19、
python">a = 1
for i in range(3):Dev.step(2)Dev.turnLeft()Dev.step(a)Dev.turnRight()a = a * 3
20、
python">a = 1
for i in range(4):Spaceship.step(a)Dev.turnLeft()Dev.step(-2)Dev.step(2)a = a * 2Spaceship.turnLeft()