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()
相关推荐
赱向远方13 分钟前
【软件推荐——pdf2docx】
python·pdf·开源软件·docx·软件推荐·doc·pdf2docx
helloworld工程师18 分钟前
Java实现PDF加水印功能:技术解析与实践指南
java·开发语言·pdf
五花肉村长36 分钟前
Linux-进程信号
linux·运维·服务器·开发语言·网络·c++
半青年1 小时前
Qt读取Excel文件的技术实现与最佳实践
c语言·c++·python·qt·c#·excel
AA-代码批发V哥1 小时前
Java-List集合类全面解析
java·开发语言·list
无闻墨客1 小时前
数据分析与应用---数据可视化基础
python·信息可视化·数据挖掘·数据分析·matplotlib
羚羊角uou1 小时前
【C++】map和multimap的常用接口详解
开发语言·c++
xiaohanbao091 小时前
day30 python 模块、包与库的高效使用指南
人工智能·python·学习·算法
Q_Q19632884751 小时前
python动漫论坛管理系统
开发语言·spring boot·python·django·flask·node.js·php
liuweidong08021 小时前
【Pandas】pandas DataFrame mode
python·数据挖掘·pandas