ICode国际青少年编程竞赛- Python-3级训练场-条件练习

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()
相关推荐
通信仿真实验室12 分钟前
(10)MATLAB莱斯(Rician)衰落信道仿真1
开发语言·matlab
勿语&15 分钟前
Element-UI Plus 暗黑主题切换及自定义主题色
开发语言·javascript·ui
belldeep1 小时前
python:reportlab 将多个图片合并成一个PDF文件
python·pdf·reportlab
吾爱星辰4 小时前
Kotlin 处理字符串和正则表达式(二十一)
java·开发语言·jvm·正则表达式·kotlin
ChinaDragonDreamer4 小时前
Kotlin:2.0.20 的新特性
android·开发语言·kotlin
FreakStudio4 小时前
全网最适合入门的面向对象编程教程:56 Python字符串与序列化-正则表达式和re模块应用
python·单片机·嵌入式·面向对象·电子diy
IT良4 小时前
c#增删改查 (数据操作的基础)
开发语言·c#
丶21364 小时前
【CUDA】【PyTorch】安装 PyTorch 与 CUDA 11.7 的详细步骤
人工智能·pytorch·python
Kalika0-05 小时前
猴子吃桃-C语言
c语言·开发语言·数据结构·算法
_.Switch5 小时前
Python Web 应用中的 API 网关集成与优化
开发语言·前端·后端·python·架构·log4j