ICode国际青少年编程竞赛- Python-1级训练场-变量的计算

ICode国际青少年编程竞赛- Python-1级训练场-变量的计算

1、

a = 2
for i in range(4):
    Spaceship.step(a-1)
    Dev.step(a)
    Dev.step(-a)
    a = a + 1

2、

a = 2
for i in range(4):
    Dev.step(2 + a)
    Dev.step(-a)
    Dev.turnRight()
    a = a + 1

3、

y = 4
for i in range(3):
    Dev.step(y)
    Dev.turnRight()
    Dev.step(y + 1)
    Dev.step(-2*(y + 1))
    Dev.step(y + 1)
    Dev.turnLeft()
    y -= 1

4、

a = 2
for i in range(3):
    Spaceship.step(2 * i)
    Dev.step(a)
    Dev.step(-2 * a)
    Dev.step(a)
    a += 2

5、

a = 5
for i in range(4):
    Spaceship.step(a)
    Dev.step(a - 1)
    Dev.step(-(a - 1))
    Dev.turnRight()
    
    Spaceship.turnRight()
    a -= 1

6、

a = 4
for i in range(3):
    Dev.step(a)
    Dev.turnRight()
    Dev.step(6 - a)
    Dev.turnLeft()
    a = a - 1

7、

a = 4
for i in range(4):
    Dev.step(-a)
    Dev.step(a)
    Spaceship.step(6 - a)
    Spaceship.turnRight()
    Dev.turnRight()
    a -= 1

8、

a = 1
for i in range(3):
    Dev.turnRight()
    Dev.step(a)
    Dev.turnLeft()
    Dev.step(-2 * a)
    a = a + 1

9、

a = 1
for i in range(4):
    Spaceship.step(a)
    Dev.step(2 * a)
    Dev.step(-2 * a)
    a += 1

10、

a = 1
for i in range(3):
    Spaceship.step(a)
    Dev.step(2 * a)
    Dev.step(-2 * a)
    a = a + 2

11、

a = 1
for i in range(4):
    Dev.step(a)
    Dev.turnLeft()
    Dev.step(5 - a)
    Dev.step(a - 5)
    Dev.turnRight()
    a = a + 1

12、

a = 9

for i in range(4):
    Dev.step()
    Dev.turnLeft()
    Dev.step(-2)
    Dev.step(a)
    Dev.step(-a + 2)
    Dev.turnRight()
    Dev.step()
    a = a - 2

13、

y = 6
for i in range(5):
    Spaceship.step(2)
    Spaceship.turnLeft()
    Spaceship.step(y)
    Spaceship.turnRight()
    Spaceship.turnRight()
    Spaceship.step(8)
    Spaceship.turnRight()
    Spaceship.turnRight()
    Spaceship.step(8 - y)
    Spaceship.turnRight()
    y -= 1

14、

y = 2
for i in range(3):
    Dev.step(y)
    Dev.turnLeft()
    Dev.step(y - 1)
    Dev.step(-6)
    Dev.step(7 - y)
    Dev.turnRight()
    y += 1

15、

a = 1
for i in range(4):
    Dev.step(a)
    Dev.turnLeft()
    Dev.step(6 - a)
    Dev.step(-2 * (6 - a))
    Dev.step(6 - a)
    Dev.turnRight()
    a = a + 1

16、

a = 2
for i in range(3):
    Dev.step(6)
    Dev.step(a - 6)
    Dev.turnRight()
    Dev.step(6)
    Dev.step(a - 6)
    Dev.turnLeft()
    a += 1

17、

a = 1
b = 1
for i in range(4):
    Dev.step(2)
    Dev.turnLeft()
    Dev.step(a)
    Dev.step(-a)
    Dev.turnRight()
    a = a + b
    b = b + 1

18、

a = 1
b = 1

for i in range(6):
    Dev.step()
    Dev.turnRight()
    Dev.step(a)
    Dev.step(-a)
    Dev.turnLeft()
    Dev.step()
    a = a + b
    b += 1

19、

a = 7
b = 3
for i in range(4):
    Dev.step(2)
    Dev.turnRight()
    
    Dev.step(a)
    Dev.step(-a)
    Dev.turnLeft()
    a = a - b
    b -= 1

20、

a = 1
b = 1
for i in range(4):
    Dev.step(a)
    Dev.step(-a)
    Dev.turnRight()
    a = a + b
    b += 2

作者:青岛少儿编程-王老师

物联沃分享整理
物联沃-IOTWORD物联网 » ICode国际青少年编程竞赛- Python-1级训练场-变量的计算

发表回复