ICode国际青少年编程竞赛- Python-3级训练场-if语句入门
1、
for i in range(5):
Spaceship.step(i + 1)
Spaceship.turnRight()
if i == 1:
Dev.step(1)
Dev.step(-1)
2、
for i in range(4):
Dev.step(2)
if i != 1:
Dev.turnLeft()
Dev.step(3)
Dev.step(-3)
Dev.turnRight()
3、
for i in range(4):
Dev.step(3)
if i == 2:
Dev.step(3)
Dev.step(-3)
Dev.step(-3)
Dev.turnRight()
4、
for i in range(5):
Spaceship.step(i + 1)
Spaceship.turnLeft()
if i != 3:
Dev.step(2)
Dev.step(-2)
Dev.turnLeft()
5、
for i in range(6):
Dev.step(2 * i + 2)
if i == 3:
Dev.step(3)
Dev.step(-3)
Dev.turnRight()
6、
for i in range(4):
Spaceship.step(3)
if not Item[i].broken():
Dev.step(4)
Dev.step(-4)
7、
for i in range(6):
Spaceship.step()
if not Item[i].broken():
Spaceship.turnLeft()
Spaceship.step(3)
Spaceship.turnLeft()
Spaceship.turnLeft()
Spaceship.step(3)
Spaceship.turnLeft()
Spaceship.step(1)
8、
for i in range(5):
Spaceship.step(3)
if not Item[i].broken():
Dev.step(5)
Dev.step(-5)
9、
for i in range(4):
Spaceship.step(Spaceship.x - Item[i + 4].x)
Dev.step(4)
if not Item[i].broken():
Dev.turnRight()
Dev.step(3)
Dev.step(-3)
Dev.turnLeft()
Dev.step(-4)
10、
for i in range(5):
Spaceship.step(2)
if not Item[i].broken():
Dev.step(-i - 1)
Dev.step(i + 1)
11、
for i in range(4):
Spaceship.step(3)
if Item[i].y > Dev.y:
Dev.step(4)
Dev.step(-4)
12、
for i in range(5):
Spaceship.step(3)
if Item[i].y != Dev.y:
Dev.step(5)
Dev.step(-5)
13、
for i in range(5):
Dev.step(2)
Dev.turnRight()
Dev.step(2)
if Item[i].y - Dev.y > 0:
Dev.step(2)
Dev.step(-2)
Dev.turnLeft()
14、
for i in range(7):
if Flyer[i].x != Dev.x:
Flyer[i].step(3)
Dev.step(Dev.y - Item.y)
15、
for i in range(5):
if Flyer[i].y != Item[0].y:
Flyer[i].step()
for i in range(2):
Dev.step(4)
Dev.turnRight()
Dev.step(4)
Dev.turnLeft()
16、
Dev.step(5)
Dev.turnRight()
for i in range(5):
Dev.step(1)
if not Item[i].broken():
Dev.turnLeft()
Dev.step(5 - i)
Dev.step(i - 5)
Dev.turnRight()
Dev.step(1)
17、
for i in range(4):
Flyer[i].step()
for i in range(2):
Dev.step(8 - i * 4)
Dev.turnRight()
Dev.step(3)
18、
for i in range(5):
Spaceship.step(i + 2)
Spaceship.turnLeft()
if i != 3:
Dev.step(2)
Dev.step(-2)
Dev.turnLeft()
19、
for i in range(5):
Dev.step(1)
Dev.turnRight()
if i != 4:
Dev.step(-2)
Dev.step(4 + i * 2)
20、
for i in range(6):
Spaceship.step(i + 1)
Spaceship.turnRight()
if not Item[i].broken():
Dev.step(1)
Dev.step(-1)
Dev.turnRight()