ICode国际青少年编程竞赛- Python-2级训练场-range函数

ICode国际青少年编程竞赛- Python-2级训练场-range函数

1、

python 复制代码
for i in range(4):
    Dev.turnLeft()
    Dev.step(i + 1)

2、

python 复制代码
for i in range(4):
    Spaceship.step(i + 1)
    Spaceship.turnRight()

3、

python 复制代码
for i in range(4):
    Spaceship.step(i + 1)
    Dev.step(2)
    Dev.step(-2)

4、

python 复制代码
for i in range(1, 5):    
    Spaceship.step(2)    
    Dev.step(i)
    Dev.step(-i)

5、

python 复制代码
for i in range(1, 4):    
    Dev.step(i)
    Dev.turnLeft()
    Dev.step(i)
    Dev.turnRight()

6、

python 复制代码
for i in range(1, 5):    
    Dev.step(i)
    Dev.step(-2 * i)
    Dev.step(i)
    Spaceship.step(2)

7、

python 复制代码
Dev.step(1)
for i in range(3):
    Spaceship.step(i + 1)
    Dev.step(i + 1)
    Dev.step(-i - 1)

8、

python 复制代码
for i in range(1, 5):
    Spaceship.step(i)
    Dev.step(i)
    Dev.step(-i)
    Spaceship.turnLeft()
    Dev.turnLeft()

9、

python 复制代码
for i in range(2, 5):
    Dev.step(i)
    Dev.turnLeft()
    Spaceship.step(i)
    Spaceship.turnRight()
    Spaceship.step(i)
    Spaceship.turnLeft()
    Dev.step(i)
    Dev.turnRight()

10、

python 复制代码
for i in range(2):
    Spaceship.step(2)
    Spaceship.turnLeft()
for i in range(4):
    Spaceship.step(2)
    Dev.step(1)
    Dev.step(-2)
    Dev.step(1)
    Dev.turnRight()
    Spaceship.step(2)
    Spaceship.turnLeft()
    Spaceship.step(3)

11、

python 复制代码
for i in range(1, 10, 2):    
    Dev.step(i)
    Dev.turnLeft()

12、

python 复制代码
for i in range(1, 8, 2):
    Spaceship.step(2)
    Dev.step(i)
    Dev.step(-i)

13、

python 复制代码
for i in range(1, 6, 2):
    Dev.step(i + 1)
    Dev.turnRight()
    Dev.step(i)
    Dev.step(-i)
    Dev.turnLeft()
    Dev.step(-i - 1)
    Spaceship.step(5)

14、

python 复制代码
for i in range(1, 8, 2):
    Spaceship.step(i)
    Dev.step(2)
    Dev.step(-2)
    Dev.turnRight()
    Spaceship.turnRight()
    Spaceship.turnRight()
    Spaceship.step(i)
    Spaceship.turnLeft()

15、

python 复制代码
for i in range(0, 7, 2):
    Spaceship.step(i)
    Spaceship.turnRight()
    Dev.step(i + 2)
    Dev.step(-i - 2)
    Dev.turnRight()

16、

python 复制代码
for i in range(1, 8, 2):
    Dev.step(2)
    Dev.turnLeft()
    
    Dev.step(i)
    Dev.step(-2 * i)
    Dev.step(i)
    
    Dev.turnRight()

17、

python 复制代码
for i in range(0, 5, 2):
    Spaceship.step(i)
    Dev.step(i + 2)
    Dev.step(-2 * (i + 2))
    Dev.step(i + 2)

18、

python 复制代码
for i in range(1,6,2):     
    Dev.step(i)
    Dev.turnLeft()
    Dev.step(3)
    Dev.turnRight()
for i in range(2,7,2):
    Spaceship.step(i)
    Spaceship.turnLeft()
    Spaceship.step()
    Spaceship.turnRight()

19、

python 复制代码
for i in range(1, 8, 2):
    Dev.step(1)
    Dev.step(-1)
    
    Spaceship.step(2)
    Dev.step(-i)
    Dev.step(i)
    
    Spaceship.step(2)
    Spaceship.turnRight()
    
    Spaceship.step(8)
    
    Spaceship.turnRight()
    Spaceship.turnRight()
    Dev.turnLeft()

20、

python 复制代码
for i in range(1, 6, 2):
    Dev.step(i)
    Dev.turnRight()
    Dev.step(i)
    Dev.turnLeft()
Dev.step(-1)
for i in range(1, 6, 2):
    Spaceship.step(i)
    Spaceship.turnRight()
    Spaceship.step(2)
    Spaceship.turnLeft()
for i in range(6, 9):
    Dev.turnRight()
    Dev.step(-i)
相关推荐
旦莫4 分钟前
Python测试开发工具库:日志脱敏工具(敏感信息自动屏蔽)
python·测试开发·自动化·ai测试
唐叔在学习9 分钟前
Python自动化指令进阶:UAC提权
后端·python
旺仔小拳头..9 分钟前
Java ---变量、常量、类型转换、默认值、重载、标识符、输入输出、访问修饰符、泛型、迭代器
java·开发语言·python
wujj_whut40 分钟前
【Conda实战】从0到1:虚拟环境创建、多Python版本管理与环境切换全指南
开发语言·python·conda
geoqiye1 小时前
2026官方认证:贵阳宠物行业短视频运营TOP5评测
大数据·python·宠物
龙腾AI白云1 小时前
AI智能体搭建(3)深度搜索智能体如何搭建与设计 Agent#智能体搭建#多智能体#VLA#大模型
python·django·virtualenv·scikit-learn·tornado
海棠AI实验室1 小时前
第十一章 错误处理体系:异常分层与可恢复策略
python·异常处理
love530love1 小时前
EPGF 新手教程 22教学模板不是压缩包:EPGF 如何设计“可复制、可检查、可回收”的课程模板?
ide·人工智能·windows·python·架构·pycharm·epgf
ai_top_trends2 小时前
不同 AI 生成 2026 年工作计划 PPT 的使用门槛对比
人工智能·python·powerpoint
adayabetter2 小时前
Python自动化办公提效相关脚本
python·自动化·自动化脚本