ICode国际青少年编程竞赛- Python-4级训练场-列表综合练习
1、
Flyer[3].step(1)
Flyer[7].step(2)
Flyer[11].step(1)
for i in range(4):
Flyer[i * 2].step(1)
Flyer[8].step(3)
for i in range(3):
Dev.turnRight()
Dev.step(-5)
2、
for i in range(5):
Flyer[i+5].step(Flyer[i+5].x - 12)
for i in range(3):
Dev.step(6)
Dev.turnLeft()
3、
Dev.turnRight()
for i in range(7):
Spaceship.step(2)
if not Item[i].broken():
Flyer[i].step()
Dev.step(5)
Dev.step(-5)
4、
for i in range(4):
if i == 0:
Spaceship.step(1)
else:
Flyer[3 - i].step(1)
Dev.step(-5)
Dev.step(5)
Dev.turnLeft()
5、
for i in range(4):
for j in range(3):
Flyer[i*3+j].step(j+1)
Dev.step(Dev.y - Item.y)
6、
for i in range(6):
Flyer[i].step(abs(Flyer[i].y - Dev.y))
Dev.step(Item[4].x - Dev.x)
7、
for i in range(13):
Flyer[i].step(abs(Dev.y - Flyer[i].y))
Dev.step(Item[6].x - Dev.x)
8、
for i in range(5):
Flyer[i].step(abs(Flyer[i].x - Item[i].x))
Dev.step(3)
Dev.turnRight()
Dev.step(2)
Dev.turnLeft()
9、
for i in range(8):
Flyer[i].step(abs(Item[i].x - Flyer[i].x))
for i in range(5):
Dev.step(3)
Dev.turnRight()
Dev.step(2)
Dev.turnLeft()
10、
for i in range(4):
Dev.step(1+i)
Dev.turnLeft()
for j in range(4):
Flyer[j].step(1+i)
Dev.step(5)
Dev.step(-5)
Dev.turnRight()
11、
for i in range(3):
for j in range(3):
Flyer[j+3*i].step(2+2*i)
Dev.turnLeft()
Dev.step(2)
Dev.turnRight()
Dev.step(4)
12、
for i in range(4):
Dev.step(2)
Dev.turnRight()
for j in range(3):
Flyer[j].step(2)
Dev.step(6)
Dev.step(-6)
Dev.turnLeft()
13、
for i in range(3):
for j in range(3):
Flyer[i*3+j].step(2)
Dev.step(3)
Dev.turnRight()
Dev.step(3)
Dev.turnLeft()
14、
for i in range(3):
for j in range(4):
Flyer[i*4+j].step(i+1)
Dev.step(5)
Dev.turnRight()
15、
for i in range(3):
for j in range(4):
Flyer[i*4+j].step(i+j+1)
Dev.turnLeft()
Dev.step(8)
16、
for i in range(3):
Dev.step(2)
for j in range(3):
Flyer[3 * i + j].step(abs(Item[3 * i + j].y - Flyer[3 * i + j].y))
Dev.step(1)
Dev.turnRight()
Dev.step(2)
Dev.turnLeft()
17、
for i in range(4):
for j in range(2):
Dev.turnLeft()
Flyer[2*i].step(4)
Flyer[2*i+1].step(4)
Dev.step(5)
while Dev.energy < 100:
wait()
Dev.step(-5)
Dev.turnRight()
if j == 0:
Dev.step(4)
Dev.turnRight()
18、
for i in range(4):
for j in range(2):
Flyer[7-2*i].step(2)
Flyer[6-2*i].step(2)
Dev.step(1)
Dev.turnRight()
Dev.step(4)
Dev.step(-4)
Dev.turnLeft()
Dev.step(1)
Dev.turnLeft()
19、
for i in range(5):
Dev.step(1)
Dev.turnRight()
for j in range(6):
Flyer[j].step()
if i > 0:
Flyer[j].step(2)
Dev.step(7)
if i < 4:
Dev.step(-11)
while Dev.energy < 100:
wait()
Dev.step(4)
Dev.turnLeft()
Dev.step(2)
20、
Dev.turnLeft()
for i in range(4):
for j in range(3):
if j > 0:
for k in range(3):
Flyer[k+3*i].step(j+1)
Dev.step(j+1)
Dev.turnLeft()
Dev.step(4)
Dev.step(-4)
Dev.turnRight()
Dev.step(1)