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)
相关推荐
Lupino1 小时前
别再只聊 AI 写代码了:技术负责人要把“变更治理”提到第一优先级
python·docker·容器
Flittly3 小时前
【从零手写 ClaudeCode:learn-claude-code 项目实战笔记】(6)Context Compact (上下文压缩)
python·agent
曲幽14 小时前
FastAPI + PostgreSQL 实战:从入门到不踩坑,一次讲透
python·sql·postgresql·fastapi·web·postgres·db·asyncpg
用户83562907805119 小时前
使用 C# 在 Excel 中创建数据透视表
后端·python
码路飞21 小时前
FastMCP 实战:一个 .py 文件,给 Claude Code 装上 3 个超实用工具
python·ai编程·mcp
dev派1 天前
AI Agent 系统中的常用 Workflow 模式(2) Evaluator-Optimizer模式
python·langchain
前端付豪1 天前
AI 数学辅导老师项目构想和初始化
前端·后端·python
用户0332126663671 天前
将 PDF 文档转换为图片【Python 教程】
python
悟空爬虫1 天前
UV实战教程,我啥要从Anaconda切换到uv来管理包?
python
dev派1 天前
AI Agent 系统中的常用 Workflow 模式(1)
python·langchain