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()
相关推荐
亿牛云爬虫专家3 小时前
Kubernetes下的分布式采集系统设计与实战:趋势监测失效引发的架构进化
分布式·python·架构·kubernetes·爬虫代理·监测·采集
iCxhust4 小时前
c# U盘映像生成工具
开发语言·单片机·c#
yangzhi_emo5 小时前
ES6笔记2
开发语言·前端·javascript
emplace_back6 小时前
C# 集合表达式和展开运算符 (..) 详解
开发语言·windows·c#
jz_ddk6 小时前
[学习] C语言数学库函数背后的故事:`double erf(double x)`
c语言·开发语言·学习
萧曵 丶6 小时前
Rust 所有权系统:深入浅出指南
开发语言·后端·rust
xiaolang_8616_wjl6 小时前
c++文字游戏_闯关打怪2.0(开源)
开发语言·c++·开源
收破烂的小熊猫~6 小时前
《Java修仙传:从凡胎到码帝》第四章:设计模式破万法
java·开发语言·设计模式
蹦蹦跳跳真可爱5897 小时前
Python----OpenCV(图像増强——高通滤波(索贝尔算子、沙尔算子、拉普拉斯算子),图像浮雕与特效处理)
人工智能·python·opencv·计算机视觉