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