本文主要是介绍ICode国际青少年编程竞赛- Python-4级训练场-嵌套for循环练习2,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
ICode国际青少年编程竞赛- Python-4级训练场-嵌套for循环练习2
1、
for i in range(3):Dev.turnRight()for j in range(3):Dev.step(-3)Dev.turnRight()Dev.step(4-2*i)
2、
for i in range(6):for j in range(2):Dev.step(2 + 2 * i)if i >= 3: Dev.step(i - 2)Dev.turnRight()
3、
for i in range(4):Spaceship.step(4)for j in range(4):Dev.step(i+2)Dev.turnLeft()for j in range(2): Spaceship.turnRight()Spaceship.step(4)Spaceship.turnRight()Dev.turnLeft()
4、
for i in range(4):Spaceship.step(3+i)for j in range(3):Dev.step(3)Dev.turnLeft()Dev.step(3)Spaceship.turnRight()
5、
for i in range(5):Spaceship.step(i+1)for j in range(3):Flyer[j].step(i+1)Dev.step(5)Dev.step(-5)
6、
for i in range(3):Dev.step(i+1)for j in range(3):Dev.turnLeft()Dev.step(1+j)Dev.turnRight()Dev.step(1+j)Dev.turnLeft()
7、
for i in range(3):Dev.step(3)Dev.turnRight()Dev.step(i-3)for j in range(4):Dev.turnLeft()Dev.step(2)Dev.step(6-i)Dev.turnLeft()
8、
for i in range(4):for j in range(3):Dev.step(5-i)Dev.turnRight()Dev.step(10-i)
9、
Dev.turnLeft()
for i in range(3):for j in range(4):Dev.step(4-i)Dev.turnRight()Dev.step(8-i*3)Spaceship.step(1)Spaceship.turnRight()Spaceship.step(1)Spaceship.turnLeft()Spaceship.step(1)
10、
for i in range(4):Dev.step(6+i)for j in range(3):Dev.turnLeft()Dev.step(2)while Dev.energy < 100:wait()
11、
for i in range(3):Dev.step(7+i)for j in range(3):Dev.turnLeft()Dev.step(2+i)Dev.step(3)Dev.turnLeft()
12、
for i in range(4):for j in range(2):Dev.step(i+1)Dev.turnRight()Dev.step(i+1)Dev.turnLeft()Dev.step(1)Dev.turnRight()
13、
for i in range(3):for j in range(3):Spaceship.step(2+i)Dev.step(2+i)Dev.step(-2-i)Spaceship.turnLeft()Dev.turnLeft()
14、
for i in range(3):for j in range(3):Dev.step(4+i-j)Dev.turnRight()Dev.turnRight()
Dev.step(-6)
15、
for i in range(3):Spaceship.step(i)for j in range(3):Dev.step(7-i*2)Dev.turnRight()
16、
for i in range(3):for j in range(3-i):Spaceship.step(i*3 + j + 1)Dev.step(1+j+i)Dev.step(-1-j-i)Spaceship.turnRight()Dev.turnRight()
17、
for i in range(4):for j in range(4-i):Spaceship.step(2+i)Dev.step(4-j-i)Dev.step(i+j-4)Spaceship.turnLeft()Dev.turnLeft()
18、
for i in range(3):Spaceship.step(2)Dev.turnRight()Dev.step(-1)for j in range(2):Dev.step(3+i)Dev.turnRight()Spaceship.step(2+i)Spaceship.turnRight()Spaceship.step(2)Spaceship.turnLeft()Spaceship.step()Dev.step(4+i)Dev.turnRight()
19、
for i in range(4):for j in range(2):Dev.step((j+1)*2)Dev.turnRight()Dev.step(3)Dev.step(-3)Dev.turnLeft()Dev.step(-6)Dev.turnRight()
20、
for i in range(3):Spaceship.step(2)Dev.turnLeft()Dev.step(1+i*4)Spaceship.turnRight()Spaceship.step(2)for j in range(3):Dev.turnLeft()Dev.step(3+i*4)Spaceship.turnLeft()
这篇关于ICode国际青少年编程竞赛- Python-4级训练场-嵌套for循环练习2的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!