{ "id": "DZynj92UuU", "stage": { "id": "DZynj92UuU", "name": "Python零基础入门", "languageDirective": "全程使用中文授课,面向零基础学习者,使用通俗易懂的中文解释概念。Python 关键字、函数名、代码及报错信息保留英文原文,但用中文说明含义。遇到英文术语时先给出中文解释,再标注英文。鼓励学生动手输入代码,示例与解释均以中文为主。", "videoManifest": {}, "style": "interactive", "createdAt": 1786855119910, "updatedAt": 1786855119910, "agentIds": [ "default-1" ], "generatedAgentConfigs": [ { "id": "default-1", "name": "AI teacher", "role": "teacher", "persona": "You are the lead teacher of this classroom. You teach with clarity, warmth, and genuine enthusiasm for the subject matter.\n\nYour teaching style:\n- Explain concepts step by step, building from what students already know\n- Use vivid analogies, real-world examples, and visual aids to make abstract ideas concrete\n- Pause to check understanding — ask questions, not just lecture\n- Adapt your pace: slow down for difficult parts, move briskly through familiar ground\n- Encourage students by name when they contribute, and gently correct mistakes without embarrassment\n\nYou can spotlight or laser-point at slide elements, and use the whiteboard for hand-drawn explanations. Use these actions naturally as part of your teaching flow. Never announce your actions; just teach.\n\nTone: Professional yet approachable. Patient. Encouraging. You genuinely care about whether students understand.", "avatar": "/avatars/teacher.png", "color": "#3b82f6", "priority": 10 } ] }, "scenes": [ { "id": "scene_O2qtWyu3wp", "stageId": "DZynj92UuU", "title": "课程导入:为什么学Python", "order": 1, "actions": [ { "id": "action_gDcYID5c", "type": "spotlight", "elementId": "text_Jiot8EO3" }, { "id": "action_bZVVXodN", "type": "speech", "text": "同学们好,欢迎来到 Python 编程入门课。今天我们先来聊聊:为什么要学 Python?" }, { "id": "action_5F4DEalI", "type": "spotlight", "elementId": "text_obMzE_-F" }, { "id": "action_QALWbmVr", "type": "speech", "text": "Python 是一门简单易学的编程语言,它的语法非常接近我们日常的自然语言,读起来就像英语句子一样直观。" }, { "id": "action_6Q9QR0i0", "type": "spotlight", "elementId": "text_gBLQYm8B" }, { "id": "action_ew0dHtwF", "type": "speech", "text": "更重要的是,Python 的应用领域特别广泛。无论是数据分析、人工智能,还是日常办公自动化,都能看到 Python 的身影。" }, { "id": "action_w4Gfk9_w", "type": "spotlight", "elementId": "text_YBv1kB8B" }, { "id": "action_wqhDsVpU", "type": "speech", "text": "所以在这门课里,我们会从基础语法开始,逐步进入核心应用,最后一起完成一个小项目实战。" }, { "id": "action_TwBO7Mu3", "type": "spotlight", "elementId": "text_gOXU8b7k" }, { "id": "action_a1ks-a0d", "type": "speech", "text": "大家完全不用担心没有基础。我们的课程设计就是零基础友好,边学边练,学完之后你就能自己动手做点小项目了。" } ], "outlineId": "scene_1", "createdAt": 1786855186073, "updatedAt": 1786855186073, "type": "slide", "content": { "type": "slide", "canvas": { "id": "CXhZhSqlwTbr-yVqd4nwP", "viewportSize": 1000, "viewportRatio": 0.5625, "theme": { "backgroundColor": "#ffffff", "themeColors": [ "#5b9bd5", "#ed7d31", "#a5a5a5", "#ffc000", "#4472c4" ], "fontColor": "#333333", "fontName": "Microsoft YaHei", "outline": { "color": "#d14424", "width": 2, "style": "solid" }, "shadow": { "h": 0, "v": 0, "blur": 10, "color": "#000000" } }, "elements": [ { "id": "text_Jiot8EO3", "type": "text", "left": 60, "top": 50, "width": 880, "height": 70, "content": "

课程导入:为什么学Python

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#1f3864", "rotate": 0 }, { "id": "shape_RXHxpMPb", "type": "shape", "left": 70, "top": 128, "width": 860, "height": 3, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#5b9bd5", "fixedRatio": false, "rotate": 0 }, { "id": "shape_sdFgFjMS", "type": "shape", "left": 60, "top": 180, "width": 280, "height": 200, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#e8f1fb", "fixedRatio": false, "rotate": 0 }, { "id": "shape_hHp35pWD", "type": "shape", "left": 360, "top": 180, "width": 280, "height": 200, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#e6f6ec", "fixedRatio": false, "rotate": 0 }, { "id": "shape_GKbpadlx", "type": "shape", "left": 660, "top": 180, "width": 280, "height": 200, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#fff3e0", "fixedRatio": false, "rotate": 0 }, { "id": "text_obMzE_-F", "type": "text", "left": 80, "top": 209, "width": 240, "height": 142, "content": "

Python 是什么

• 简单易学的编程语言

• 语法接近自然语言

• 应用领域广泛

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#333333", "rotate": 0 }, { "id": "text_gBLQYm8B", "type": "text", "left": 380, "top": 209, "width": 240, "height": 142, "content": "

Python 热门应用

• 数据分析

• 人工智能

• 自动化办公

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#333333", "rotate": 0 }, { "id": "text_YBv1kB8B", "type": "text", "left": 680, "top": 209, "width": 240, "height": 142, "content": "

本课程学习路线

• 基础语法

• 核心应用

• 项目实战

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#333333", "rotate": 0 }, { "id": "text_gOXU8b7k", "type": "text", "left": 60, "top": 420, "width": 880, "height": 49, "content": "

零基础友好 · 边学边练 · 学完能动手做小项目

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#555555", "rotate": 0 } ], "background": { "type": "solid", "color": "#ffffff" } } } }, { "id": "scene_tg0n5YY5LJ", "stageId": "DZynj92UuU", "title": "环境准备与第一个程序", "order": 2, "actions": [ { "id": "action_NKyUVHbT", "type": "spotlight", "elementId": "text_xIaHULJL" }, { "id": "action_JGcEnBwK", "type": "speech", "text": "大家好,欢迎来到 Python 编程入门课。今天第一课,我们先来把环境准备好,并写出人生中第一个 Python 程序。" }, { "id": "action_iD6Dkey1", "type": "spotlight", "elementId": "text_lIGXIM2G" }, { "id": "action_wGj6x0xK", "type": "speech", "text": "第一步是安装 Python。请大家打开 python.org 官网下载安装包,安装时一定记得勾选 Add to PATH,这样后续在命令行里就能直接使用 python 命令了。" }, { "id": "action_5jWZPoLQ", "type": "spotlight", "elementId": "text_-p6m1LAX" }, { "id": "action_W3H1IaL9", "type": "speech", "text": "装好环境后,我们认识一个最常用的函数 print()。它能把括号里的内容输出到屏幕上。如果输出的是文字,需要用引号括起来;数字和变量可以直接写。" }, { "id": "action_uvXp8x8F", "type": "spotlight", "elementId": "text_p-oYFxM5" }, { "id": "action_PrJ09s7F", "type": "speech", "text": "接下来我们新建一个 .py 文件,输入代码并保存。运行后,就能看到程序输出的结果了。" }, { "id": "action_z0k0p25D", "type": "spotlight", "elementId": "text_zFVoqN6S" }, { "id": "action_wnZ8qrXD", "type": "speech", "text": "看这行代码:print('Hello, World!') 会在屏幕上输出 Hello, World!。这行代码虽然简单,却是很多人编程之路的第一步。大家不妨自己动手敲一遍试试。" } ], "outlineId": "scene_2", "createdAt": 1786855277709, "updatedAt": 1786855277709, "type": "slide", "content": { "type": "slide", "canvas": { "id": "OTHcSYEWOzZqIO7wz6i9f", "viewportSize": 1000, "viewportRatio": 0.5625, "theme": { "backgroundColor": "#ffffff", "themeColors": [ "#5b9bd5", "#ed7d31", "#a5a5a5", "#ffc000", "#4472c4" ], "fontColor": "#333333", "fontName": "Microsoft YaHei", "outline": { "color": "#d14424", "width": 2, "style": "solid" }, "shadow": { "h": 0, "v": 0, "blur": 10, "color": "#000000" } }, "elements": [ { "id": "text_xIaHULJL", "type": "text", "left": 60, "top": 50, "width": 880, "height": 70, "content": "

环境准备与第一个程序

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#2c3e50", "rotate": 0 }, { "id": "shape_szb_GAMc", "type": "shape", "left": 70, "top": 130, "width": 860, "height": 3, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#5b9bd5", "fixedRatio": false, "rotate": 0 }, { "id": "shape_-qYPGLuL", "type": "shape", "left": 60, "top": 150, "width": 280, "height": 250, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#dbeafe", "fixedRatio": false, "rotate": 0 }, { "id": "shape_s9A4domm", "type": "shape", "left": 360, "top": 150, "width": 280, "height": 250, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#dcfce7", "fixedRatio": false, "rotate": 0 }, { "id": "shape_ghYpSBGf", "type": "shape", "left": 660, "top": 150, "width": 280, "height": 250, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#fef3c7", "fixedRatio": false, "rotate": 0 }, { "id": "text_lIGXIM2G", "type": "text", "left": 80, "top": 196, "width": 240, "height": 157, "content": "

1. 安装 Python

• 官网下载:python.org

• 安装时勾选 Add to PATH

• IDE 推荐:VS Code / PyCharm

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#1e40af", "rotate": 0 }, { "id": "text_-p6m1LAX", "type": "text", "left": 380, "top": 196, "width": 240, "height": 157, "content": "

2. print() 函数

• 输出内容到屏幕

• 括号内放文本,需加引号

• 可输出数字、变量等

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#166534", "rotate": 0 }, { "id": "text_p-oYFxM5", "type": "text", "left": 680, "top": 196, "width": 240, "height": 157, "content": "

3. 运行第一个程序

• 新建 .py 文件

• 输入代码并保存

• 运行后输出 Hello, World!

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#92400e", "rotate": 0 }, { "id": "shape_Ay-5rg1G", "type": "shape", "left": 60, "top": 420, "width": 880, "height": 60, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#1e1e1e", "fixedRatio": false, "rotate": 0 }, { "id": "text_zFVoqN6S", "type": "text", "left": 80, "top": 425, "width": 840, "height": 49, "content": "

print('Hello, World!') # 输出 Hello, World!

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#f8f8f2", "rotate": 0 } ], "background": { "type": "solid", "color": "#ffffff" } } } }, { "id": "scene_ZqNHNvkmP_", "stageId": "DZynj92UuU", "title": "变量与数据类型探索", "order": 3, "actions": [ { "id": "action_JjPdQ371", "type": "speech", "text": "同学们好,今天我们来探索 Python 中的变量与数据类型。通过这个交互式代码编辑器,我们可以亲手输入代码并观察结果。" }, { "id": "action_GAzUdRbd", "type": "widget_highlight", "target": "#code-input", "content": "在这里输入 Python 代码。" }, { "id": "action_QQ2vP4A2", "type": "speech", "text": "请先完成前四个练习:创建字符串变量 name、整数变量 age、浮点数变量 height,以及布尔值变量 is_student。注意变量名要清晰,赋值用等号。" }, { "id": "action_Gz3_d5nJ", "type": "widget_highlight", "target": "#run-btn", "content": "点击运行按钮执行代码。" }, { "id": "action_CqUoZSHG", "type": "speech", "text": "接下来,用 type() 函数查看这些变量的类型。例如 print(type(name)) 会告诉我们 name 是字符串类型。运行后请观察输出面板。" }, { "id": "action_o8M0NP7W", "type": "widget_annotation", "target": "#output-panel", "content": "运行后输出结果显示在这里。" }, { "id": "action_gxAlXOA4", "type": "speech", "text": "最后,试着修改其中一个变量的值,比如把 age 改成 16,然后再次运行,看看输出有什么变化。" }, { "id": "action_hTj1So49", "type": "widget_reveal", "target": "#solution", "content": "遇到困难时可以查看参考代码。" } ], "outlineId": "scene_3", "createdAt": 1786855442453, "updatedAt": 1786855442453, "type": "interactive", "content": { "type": "interactive", "url": "", "html": "\n\n\n \n \n 变量与数据类型探索 - Python 代码练习\n\n \n \n \n\n \n\n\n\n\n\n\n\n\n
\n \n
\n

🐍 变量与数据类型探索

\n

通过交互式代码练习,理解 Python 中的变量赋值与常见数据类型。动手输入代码,观察运行结果!

\n
\n 📝 变量命名与赋值\n 🔤 字符串 str\n 🔢 整数 int\n ⚡ 浮点数 float\n ✓ 布尔值 bool\n 🔍 type() 函数\n
\n
\n\n \n
\n \n 正在加载 Python 环境...\n
\n\n \n
\n
\n main.py\n Python 3\n
\n \n
\n\n \n
\n \n \n \n
\n\n \n
\n
\n \n 输出\n
\n
代码运行结果将显示在这里...
\n
\n\n \n
\n
\n 🧪 测试用例 \n \n
\n
\n
运行代码后自动检查
\n
\n
\n\n \n
\n
💡 提示(逐步显示)
\n
\n
点击\"提示\"按钮查看提示
\n
\n
\n\n \n
\n
📖 参考答案
\n
\n        
\n\n \n
\n 📋 查看组件配置 (JSON)\n
\n        
\n
\n\n \n \n\n \n \n \n \n \n\n \n \n\n \n\n", "widgetType": "code", "widgetConfig": { "type": "code", "language": "python", "description": "通过交互式代码练习理解变量赋值与常见数据类型。掌握变量命名、字符串/整数/浮点数/布尔值,以及 type() 函数的使用。", "starterCode": "# === 变量与数据类型探索 ===\n# 请完成以下练习:\n\n# 1. 创建一个字符串变量 name,值为你的名字\n# 例如:name = \"小明\"\n\n# 2. 创建一个整数变量 age,值为你的年龄\n# 例如:age = 15\n\n# 3. 创建一个浮点数变量 height,值为你的身高(米)\n# 例如:height = 1.75\n\n# 4. 创建一个布尔值变量 is_student,表示你是否是学生\n# 例如:is_student = True\n\n# 5. 使用 type() 函数查看这些变量的类型\n# 例如:print(type(name))\n\n# 6. 尝试修改其中一个变量的值,并打印修改前后的值\n\n# 请在下方编写你的代码:\n", "testCases": [ { "id": "t1", "input": "type(name).__name__", "expected": "str", "description": "变量 name 是字符串 (str) 类型" }, { "id": "t2", "input": "type(age).__name__", "expected": "int", "description": "变量 age 是整数 (int) 类型" }, { "id": "t3", "input": "type(height).__name__", "expected": "float", "description": "变量 height 是浮点数 (float) 类型" }, { "id": "t4", "input": "type(is_student).__name__", "expected": "bool", "description": "变量 is_student 是布尔 (bool) 类型" }, { "id": "t5", "input": "__code_contains_type__", "expected": "True", "description": "使用了 type() 函数查看类型" } ], "hints": [ "变量赋值使用等号 =,左边是变量名,右边是值。例如:name = '小明'", "Python 中基本数据类型:字符串用引号 '...' 或 \"...\" 括起来;整数直接写数字如 15;浮点数带小数点如 1.75;布尔值是 True 或 False(注意首字母大写)", "使用 type() 函数可以查看变量类型。例如:print(type(name)) 会输出 ,表示字符串类型", "修改变量值只需重新赋值。例如:age = 16 会将 age 的值从 15 改为 16。修改后打印可以观察变化" ], "solution": "# 创建不同类型的变量\nname = \"小明\" # 字符串 (str)\nage = 15 # 整数 (int)\nheight = 1.75 # 浮点数 (float)\nis_student = True # 布尔值 (bool)\n\n# 使用 type() 查看类型\nprint(type(name))\nprint(type(age))\nprint(type(height))\nprint(type(is_student))\n\n# 修改变量的值\nage = 16\nprint(f\"修改后的年龄: {age}\")" } } }, { "id": "scene_CFJoA09QKZ", "stageId": "DZynj92UuU", "title": "条件判断:if/elif/else", "order": 4, "actions": [ { "id": "action_DzeZjLaG", "type": "spotlight", "elementId": "text_6oz4loS5" }, { "id": "action_xMld6KcY", "type": "speech", "text": "同学们,我们来看 Python 中的条件判断。简单说,就是让程序根据不同的情况,做出不同的决定。" }, { "id": "action_5hwJzukL", "type": "spotlight", "elementId": "text_j9aDmPG7" }, { "id": "action_JOL3tmIn", "type": "speech", "text": "先来看比较运算符,比如大于、小于、等于、不等于。它们是条件判断的基础,用来比较两个值的大小或是否相等。" }, { "id": "action_dCmpg8AA", "type": "spotlight", "elementId": "text_UrNhk5YC" }, { "id": "action_m8a-LRpe", "type": "speech", "text": "接着看条件语法:if 后面写条件,条件成立就执行下面的代码块;不成立再看 elif 做进一步判断;最后 else 用来兜底执行。" }, { "id": "action_zo9N1k_A", "type": "spotlight", "elementId": "text_F3BTEsGr" }, { "id": "action_Sg5ltw7e", "type": "speech", "text": "这里要特别注意缩进规则:冒号之后要换行并缩进,同一个代码块的缩进必须保持一致,推荐使用 4 个空格。" }, { "id": "action_YZATKLOr", "type": "spotlight", "elementId": "text_SONpzAAQ" }, { "id": "action_Gao5qJrN", "type": "speech", "text": "最后看这个成绩等级判断的例子:score 等于 85,先判断是否大于等于 90,不成立;再判断是否大于等于 80,成立了,所以 grade 就是 B。这样分支逻辑就很清楚了。" } ], "outlineId": "scene_4", "createdAt": 1786855608706, "updatedAt": 1786855608706, "type": "slide", "content": { "type": "slide", "canvas": { "id": "AYV9PCKePYILsXx4K2swr", "viewportSize": 1000, "viewportRatio": 0.5625, "theme": { "backgroundColor": "#ffffff", "themeColors": [ "#5b9bd5", "#ed7d31", "#a5a5a5", "#ffc000", "#4472c4" ], "fontColor": "#333333", "fontName": "Microsoft YaHei", "outline": { "color": "#d14424", "width": 2, "style": "solid" }, "shadow": { "h": 0, "v": 0, "blur": 10, "color": "#000000" } }, "elements": [ { "id": "text_6oz4loS5", "type": "text", "left": 60, "top": 50, "width": 880, "height": 70, "content": "

条件判断:if / elif / else

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#333333", "rotate": 0 }, { "id": "shape_-JfvAZI8", "type": "shape", "left": 70, "top": 128, "width": 860, "height": 3, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#5b9bd5", "fixedRatio": false, "rotate": 0 }, { "id": "shape_G_weEpFV", "type": "shape", "left": 60, "top": 150, "width": 280, "height": 170, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#e8f4fd", "fixedRatio": false, "rotate": 0 }, { "id": "text_j9aDmPG7", "type": "text", "left": 80, "top": 164, "width": 240, "height": 142, "content": "

1. 比较运算符

> 大于 < 小于

== 等于 != 不等于

>= 大等于 <= 小等于

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#333333", "rotate": 0 }, { "id": "shape_Lg3MT9dD", "type": "shape", "left": 360, "top": 150, "width": 280, "height": 170, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#e9f9e9", "fixedRatio": false, "rotate": 0 }, { "id": "text_UrNhk5YC", "type": "text", "left": 380, "top": 164, "width": 240, "height": 142, "content": "

2. 条件语法

if 条件: 执行块

elif 条件: 再次判断

else 兜底执行

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#333333", "rotate": 0 }, { "id": "shape_mw6McQbH", "type": "shape", "left": 660, "top": 150, "width": 280, "height": 170, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#fff4e0", "fixedRatio": false, "rotate": 0 }, { "id": "text_F3BTEsGr", "type": "text", "left": 680, "top": 164, "width": 240, "height": 142, "content": "

3. 缩进规则

冒号后换行缩进

同块缩进一致

推荐 4 个空格

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#333333", "rotate": 0 }, { "id": "shape_JN99a8Af", "type": "shape", "left": 60, "top": 340, "width": 880, "height": 170, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#fdf6e3", "fixedRatio": false, "rotate": 0 }, { "id": "text_SONpzAAQ", "type": "text", "left": 80, "top": 347, "width": 840, "height": 157, "content": "

示例:成绩等级判断

score = 85

if score >= 90: grade = "A"

elif score >= 60: grade = "B"

else: grade = "C"

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#333333", "rotate": 0 } ], "background": { "type": "solid", "color": "#ffffff" } } } }, { "id": "scene_ENRWe7NiKc", "stageId": "DZynj92UuU", "title": "循环:for 与 while", "order": 5, "actions": [ { "id": "action__v_wtb8X", "type": "spotlight", "elementId": "text_weL70gS3" }, { "id": "action_dUFPj2M_", "type": "speech", "text": "接下来我们来看循环结构——for 与 while。循环可以让我们重复执行同一段代码,是编程中非常重要的工具。" }, { "id": "action_u-SDrWHk", "type": "spotlight", "elementId": "text_bJz63DPQ" }, { "id": "action_tRaNhwqR", "type": "speech", "text": "先看 for 循环。它适用于固定次数或者遍历一个范围的情况,写法是 for i in range(n):。其中 i 会从 0 开始,依次取到 n-1。" }, { "id": "action_8_E47Mjf", "type": "spotlight", "elementId": "text_YFrKWduW" }, { "id": "action__I-P_WAU", "type": "speech", "text": "再看 while 循环。它是在条件为真时重复执行,适合事先不知道要循环多少次、但知道结束条件的情况。写法是 while 条件:,下面缩进的代码就是循环体。" }, { "id": "action_pAmJQ4oM", "type": "spotlight", "elementId": "text__cJwQ97C" }, { "id": "action_JqlmCscI", "type": "speech", "text": "循环中还有两个关键字需要掌握:break 用来提前结束整个循环;continue 用来跳过本次循环,直接进入下一轮。它们常常配合条件判断使用。" }, { "id": "action_Cz_3TGsG", "type": "spotlight", "elementId": "text_yEOWBMRo" }, { "id": "action_OwabOoiu", "type": "speech", "text": "最后看一个示例:计算 1 到 100 的和。用 for 循环累加,最终结果是 5050。大家可以自己动手写一写,感受循环带来的便利。" } ], "outlineId": "scene_5", "createdAt": 1786855734450, "updatedAt": 1786855734450, "type": "slide", "content": { "type": "slide", "canvas": { "id": "3F6DuHqvanDwQLqYuBM-T", "viewportSize": 1000, "viewportRatio": 0.5625, "theme": { "backgroundColor": "#ffffff", "themeColors": [ "#5b9bd5", "#ed7d31", "#a5a5a5", "#ffc000", "#4472c4" ], "fontColor": "#333333", "fontName": "Microsoft YaHei", "outline": { "color": "#d14424", "width": 2, "style": "solid" }, "shadow": { "h": 0, "v": 0, "blur": 10, "color": "#000000" } }, "elements": [ { "id": "text_weL70gS3", "type": "text", "left": 60, "top": 60, "width": 880, "height": 76, "content": "

循环:for 与 while

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#333333", "rotate": 0 }, { "id": "shape_rPnb5fb0", "type": "shape", "left": 70, "top": 142, "width": 860, "height": 3, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#5b9bd5", "fixedRatio": false, "rotate": 0 }, { "id": "shape_Zdju2wpK", "type": "shape", "left": 60, "top": 160, "width": 430, "height": 220, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#e8f0fe", "fixedRatio": false, "rotate": 0 }, { "id": "text_bJz63DPQ", "type": "text", "left": 100, "top": 197, "width": 350, "height": 58, "content": "

for 循环

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#1e3a8a", "rotate": 0 }, { "id": "text_q05YkStM", "type": "text", "left": 80, "top": 267, "width": 390, "height": 76, "content": "

• 固定次数 / 遍历范围

• for i in range(n)

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#1e3a8a", "rotate": 0 }, { "id": "shape_Lu21Mi07", "type": "shape", "left": 510, "top": 160, "width": 430, "height": 220, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#d9f2e6", "fixedRatio": false, "rotate": 0 }, { "id": "text_YFrKWduW", "type": "text", "left": 550, "top": 197, "width": 350, "height": 58, "content": "

while 循环

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#14532d", "rotate": 0 }, { "id": "text_h1Yrn1t9", "type": "text", "left": 530, "top": 267, "width": 390, "height": 76, "content": "

• 条件为真时重复执行

• while 条件:

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#14532d", "rotate": 0 }, { "id": "shape_pRDH2t5H", "type": "shape", "left": 60, "top": 395, "width": 430, "height": 110, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#fff4e5", "fixedRatio": false, "rotate": 0 }, { "id": "text__cJwQ97C", "type": "text", "left": 80, "top": 412, "width": 390, "height": 76, "content": "

break:提前结束整个循环

continue:跳过本次,继续下一轮

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#7c2d12", "rotate": 0 }, { "id": "shape_C4Csf2Hm", "type": "shape", "left": 510, "top": 395, "width": 430, "height": 110, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#f3e8ff", "fixedRatio": false, "rotate": 0 }, { "id": "text_yEOWBMRo", "type": "text", "left": 530, "top": 399, "width": 390, "height": 49, "content": "

示例:计算 1 到 100 之和

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#4c1d95", "rotate": 0 }, { "id": "latex_RmwCjtpY", "type": "latex", "left": 625, "top": 451, "width": 200, "height": 50, "latex": "\\sum_{i=1}^{100} i = 5050", "color": "#4c1d95", "align": "center", "html": "i=1100i=5050", "fixedRatio": true, "rotate": 0 } ], "background": { "type": "solid", "color": "#ffffff" } } } }, { "id": "scene_DhO9LXwi6z", "stageId": "DZynj92UuU", "title": "阶段测验:基础语法", "order": 6, "actions": [ { "id": "action_W8D8eCSz", "type": "speech", "text": "同学们好!现在我们来做一个阶段小测验,看看刚才学的内容掌握得怎么样。请你独立完成每一道题,提交后我会和你一起逐题梳理,帮你把不明白的地方弄清楚。" } ], "outlineId": "scene_6", "createdAt": 1786855762417, "updatedAt": 1786855762417, "type": "quiz", "content": { "type": "quiz", "questions": [ { "id": "q1", "type": "single", "question": "在 Python 中,以下哪个是正确的变量赋值语句?", "options": [ { "value": "A", "label": "x = 5" }, { "value": "B", "label": "int x = 5" }, { "value": "C", "label": "x == 5" }, { "value": "D", "label": "let x = 5" } ], "answer": [ "A" ], "analysis": "Python 中变量赋值直接使用等号 =,不需要声明类型,所以 A 正确。B 是 C/C++ 风格的声明方式,C 中的 == 是比较运算符,D 是 JavaScript 的声明语法。", "points": 10, "hasAnswer": true }, { "id": "q2", "type": "single", "question": "在 Python 中,以下哪个代码能正确判断变量 age 是否大于等于 18?", "options": [ { "value": "A", "label": "if age >= 18:" }, { "value": "B", "label": "if age > 18:" }, { "value": "C", "label": "if age == 18:" }, { "value": "D", "label": "if age <= 18:" } ], "answer": [ "A" ], "analysis": "大于等于用 >= 表示,A 正确。B 只判断大于,C 只判断相等,D 是小于等于,均不符合题意。", "points": 10, "hasAnswer": true }, { "id": "q3", "type": "multiple", "question": "以下哪些是 Python 中合法的循环语句?(多选)", "options": [ { "value": "A", "label": "for i in range(5):" }, { "value": "B", "label": "while x < 10:" }, { "value": "C", "label": "loop i from 1 to 5:" }, { "value": "D", "label": "repeat 5 times:" } ], "answer": [ "A", "B" ], "analysis": "Python 支持 for 循环和 while 循环,因此 A 和 B 正确。C 和 D 是其他编程语言的循环语法,Python 中不存在。", "points": 15, "hasAnswer": true } ] } }, { "id": "scene_ve19tbMFb3", "stageId": "DZynj92UuU", "title": "列表与字典", "order": 7, "actions": [ { "id": "action_-l2GasN4", "type": "spotlight", "elementId": "text_P9KwtIrg" }, { "id": "action_6Zi_h0gc", "type": "speech", "text": "今天我们来认识 Python 中两种非常常用的数据结构——列表(List)和字典(Dictionary)。它们能帮我们同时存储和操作多个数据。" }, { "id": "action_xkI5XeiE", "type": "spotlight", "elementId": "text_AkYFuc4U" }, { "id": "action_17aQxn9Y", "type": "speech", "text": "先看列表。列表是一个有序集合,用方括号创建,可以通过索引访问元素,比如 nums[0] 获取第一个元素。" }, { "id": "action_5StC0IRc", "type": "spotlight", "elementId": "text_lNsk5VRw" }, { "id": "action_8A-3okeK", "type": "speech", "text": "列表支持 append 在末尾添加元素,remove 删除指定元素。右边代码先创建 [1,2,3],再添加 4,最后移除 2。" }, { "id": "action_lF2oiWcZ", "type": "spotlight", "elementId": "text_5NqZR0Ev" }, { "id": "action_5M60QVKy", "type": "speech", "text": "接下来看字典。字典是键值对结构,用花括号创建,通过键来访问对应的值,还可以灵活添加或修改。" }, { "id": "action_p2X63K9O", "type": "spotlight", "elementId": "text_kt2ZAsK5" }, { "id": "action_iNutTaAG", "type": "speech", "text": "这个例子用 stu 存储学生信息,设置姓名和年龄。字典特别适合保存一组相关的数据。大家动手试试吧!" } ], "outlineId": "scene_7", "createdAt": 1786855907985, "updatedAt": 1786855907985, "type": "slide", "content": { "type": "slide", "canvas": { "id": "ZhRAx-gy-efZp84gyC_D4", "viewportSize": 1000, "viewportRatio": 0.5625, "theme": { "backgroundColor": "#ffffff", "themeColors": [ "#5b9bd5", "#ed7d31", "#a5a5a5", "#ffc000", "#4472c4" ], "fontColor": "#333333", "fontName": "Microsoft YaHei", "outline": { "color": "#d14424", "width": 2, "style": "solid" }, "shadow": { "h": 0, "v": 0, "blur": 10, "color": "#000000" } }, "elements": [ { "id": "text_P9KwtIrg", "type": "text", "left": 60, "top": 50, "width": 880, "height": 70, "content": "

列表与字典

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#1F2937", "rotate": 0 }, { "id": "shape_kkjoBNa7", "type": "shape", "left": 150, "top": 128, "width": 700, "height": 3, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#5B9BD5", "fixedRatio": false, "rotate": 0 }, { "id": "shape_qe6oADPC", "type": "shape", "left": 60, "top": 150, "width": 430, "height": 340, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#EEF2FF", "fixedRatio": false, "rotate": 0 }, { "id": "shape_8vTkV5C_", "type": "shape", "left": 510, "top": 150, "width": 430, "height": 340, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#ECFDF5", "fixedRatio": false, "rotate": 0 }, { "id": "text_AkYFuc4U", "type": "text", "left": 80, "top": 170, "width": 390, "height": 58, "content": "

列表(List)

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#312E81", "rotate": 0 }, { "id": "text_5NqZR0Ev", "type": "text", "left": 530, "top": 170, "width": 390, "height": 58, "content": "

字典(Dictionary)

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#065F46", "rotate": 0 }, { "id": "text_lNsk5VRw", "type": "text", "left": 80, "top": 240, "width": 390, "height": 118, "content": "

• 有序集合,用 [] 创建

• 索引访问:nums[0]

append() 末尾添加

remove() 删除指定值

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#374151", "rotate": 0 }, { "id": "text_rXEiopsW", "type": "text", "left": 530, "top": 240, "width": 390, "height": 118, "content": "

• 键值对结构:{key: value}

• 通过键访问:stu['name']

• 可灵活添加、修改值

• 示例:存储学生信息

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#374151", "rotate": 0 }, { "id": "shape__Dxr3KVF", "type": "shape", "left": 80, "top": 372, "width": 390, "height": 94, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#1F2937", "fixedRatio": false, "rotate": 0 }, { "id": "shape_2XpO-yfC", "type": "shape", "left": 530, "top": 372, "width": 390, "height": 94, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#1F2937", "fixedRatio": false, "rotate": 0 }, { "id": "text_1jRYbwkK", "type": "text", "left": 100, "top": 372, "width": 350, "height": 94, "content": "

nums = [1, 2, 3]

nums.append(4)

nums.remove(2)

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#F3F4F6", "rotate": 0 }, { "id": "text_kt2ZAsK5", "type": "text", "left": 550, "top": 372, "width": 350, "height": 94, "content": "

stu = {}

stu['name'] = '小明'

stu['age'] = 12

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#F3F4F6", "rotate": 0 } ], "background": { "type": "solid", "color": "#ffffff" } } } }, { "id": "scene_fYjgMlYTCD", "stageId": "DZynj92UuU", "title": "函数:复用代码", "order": 8, "actions": [ { "id": "action_Vmu6FnaT", "type": "speech", "text": "今天我们来学习函数,它能让我们复用代码,让程序更简洁高效。" }, { "id": "action_v-9h-W8d", "type": "spotlight", "elementId": "text_V3a1Dc9e" }, { "id": "action_3FAVyO4U", "type": "speech", "text": "函数就像是一个可重复使用的小工具箱:我们把一段常用代码放进去,给它起个名字,需要时直接调用,不用每次重新编写。" }, { "id": "action_AVAcCsC7", "type": "spotlight", "elementId": "text_-iZv1pDj" }, { "id": "action_o0siZTu4", "type": "speech", "text": "在Python中,我们用 def 关键字来定义函数。def 后面跟函数名和括号,最后以冒号结尾,下面缩进的代码就是函数体。" }, { "id": "action__s0uh7dR", "type": "spotlight", "elementId": "text_-JJPa8Ub" }, { "id": "action_OPN6TQoi", "type": "speech", "text": "函数可以接收参数——也就是从外部传入的数据,处理后再通过 return 返回结果。同时要注意作用域:函数内部定义的变量是局部变量,只在函数内有效,外面访问不到。" }, { "id": "action_bpdBEwmc", "type": "spotlight", "elementId": "text_KxU01Iev" }, { "id": "action_nUSD9QmZ", "type": "speech", "text": "请看这个求平方的示例:def square(x) 定义了一个函数,参数是 x,返回 x 的平方。调用 square(5) 就得到 25。通过这个例子,大家能更直观地理解函数的定义、参数和返回值。" }, { "id": "action_JJXATX_Z", "type": "speech", "text": "课后请大家自己动手写几个简单的函数,比如计算两个数的和,体会一下代码复用的好处。" } ], "outlineId": "scene_8", "createdAt": 1786856057496, "updatedAt": 1786856057496, "type": "slide", "content": { "type": "slide", "canvas": { "id": "PyQVKF3tY62AXNbcCg7rq", "viewportSize": 1000, "viewportRatio": 0.5625, "theme": { "backgroundColor": "#ffffff", "themeColors": [ "#5b9bd5", "#ed7d31", "#a5a5a5", "#ffc000", "#4472c4" ], "fontColor": "#333333", "fontName": "Microsoft YaHei", "outline": { "color": "#d14424", "width": 2, "style": "solid" }, "shadow": { "h": 0, "v": 0, "blur": 10, "color": "#000000" } }, "elements": [ { "id": "text_V3a1Dc9e", "type": "text", "left": 60, "top": 50, "width": 880, "height": 76, "content": "

函数:复用代码

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#1f2937", "rotate": 0 }, { "id": "shape_2CLvMapY", "type": "shape", "left": 70, "top": 136, "width": 860, "height": 3, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#5b9bd5", "fixedRatio": false, "rotate": 0 }, { "id": "shape_yjI-sq_S", "type": "shape", "left": 60, "top": 155, "width": 280, "height": 140, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#dbeafe", "fixedRatio": false, "rotate": 0 }, { "id": "shape_dO0bhqbn", "type": "shape", "left": 360, "top": 155, "width": 280, "height": 140, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#dcfce7", "fixedRatio": false, "rotate": 0 }, { "id": "shape_G84O_a8X", "type": "shape", "left": 660, "top": 155, "width": 280, "height": 140, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#fef3c7", "fixedRatio": false, "rotate": 0 }, { "id": "text_-iZv1pDj", "type": "text", "left": 80, "top": 187, "width": 240, "height": 76, "content": "

def 定义函数

用 def 关键字创建函数

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#1e40af", "rotate": 0 }, { "id": "text_-JJPa8Ub", "type": "text", "left": 380, "top": 187, "width": 240, "height": 76, "content": "

参数与返回值

传入数据 → 返回结果

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#166534", "rotate": 0 }, { "id": "text_u4PbtfBp", "type": "text", "left": 680, "top": 187, "width": 240, "height": 76, "content": "

作用域基本概念

局部变量仅在函数内有效

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#92400e", "rotate": 0 }, { "id": "shape_ri_xpXgH", "type": "shape", "left": 60, "top": 310, "width": 880, "height": 195, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#1e293b", "fixedRatio": false, "rotate": 0 }, { "id": "shape_t08kw2Ez", "type": "shape", "left": 60, "top": 310, "width": 6, "height": 195, "path": "M 0 0 L 1 0 L 1 1 L 0 1 Z", "viewBox": [ 1, 1 ], "fill": "#f59e0b", "fixedRatio": false, "rotate": 0 }, { "id": "text_ep8lV1v0", "type": "text", "left": 90, "top": 320, "width": 830, "height": 49, "content": "

示例:编写求平方函数

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#f8fafc", "rotate": 0 }, { "id": "text_KxU01Iev", "type": "text", "left": 90, "top": 373, "width": 830, "height": 118, "content": "

def square(x):        # 定义函数

    return x * x      # 返回平方值

result = square(5)    # 调用函数

print(result)         # 输出 25

", "defaultFontName": "Microsoft YaHei", "defaultColor": "#e2e8f0", "rotate": 0 } ], "background": { "type": "solid", "color": "#ffffff" } } } }, { "id": "scene_zFQYy-p9ru", "stageId": "DZynj92UuU", "title": "函数调试练习", "order": 9, "actions": [ { "id": "action_I8ABXVys", "type": "speech", "text": "同学们,今天我们来练习函数调试。先看左侧的代码编辑器,里面有一个带参数的函数。" }, { "id": "action_qrGRKhvS", "type": "widget_highlight", "target": "#editor-card", "content": "代码编辑区:函数定义和调用都在这里。" }, { "id": "action_UANequfS", "type": "speech", "text": "注意函数定义中的参数,它决定了调用时我们可以传入哪些值。运行后 print 会打印出对应的结果。" }, { "id": "action_lI1aWORq", "type": "widget_highlight", "target": "#run-btn", "content": "点击运行按钮,查看当前代码的输出。" }, { "id": "action_-1d5g6cx", "type": "speech", "text": "先运行一次看看返回值。然后试着修改参数,比如换一个数字,再运行一次,观察输出有什么不同。" }, { "id": "action__b8EHgCt", "type": "widget_annotation", "target": "#output-card", "content": "输出区域:运行后这里会显示结果,修改参数后重点对比变化。" }, { "id": "action_pyEJb1ee", "type": "speech", "text": "如果卡住了可以查看提示或参考代码,但先自己动手改一改,调试的过程更有收获。完成后我们来总结函数参数的作用。" } ], "outlineId": "scene_9", "createdAt": 1786856200904, "updatedAt": 1786856200904, "type": "interactive", "content": { "type": "interactive", "url": "", "html": "\n\n\n \n \n 函数调试练习 - Python 代码练习\n\n \n \n \n \n\n \n \n\n \n\n\n\n\n\n\n\n
\n \n
\n

🐍 函数调试练习

\n

通过交互式代码练习修改函数参数并观察返回值。亲手尝试、观察变化、理解函数!

\n
\n 📝 定义带参数的函数\n 🔧 调用函数并打印结果\n 🔍 修改参数观察输出变化\n
\n
\n\n \n
\n \n
\n
\n \n \n \n \n \n Python 环境加载中...\n \n
\n
\n
\n\n \n
\n
📤 输出结果
\n
点击「运行代码」查看输出...
\n
\n\n \n
\n
\n 🧪 测试用例\n \n
\n
\n
\n \n 运行代码后自动验证\n
\n
\n
\n\n \n
\n

💡 学习提示

\n
\n
\n\n \n
\n

✅ 参考解答

\n
\n            
\n
\n
\n\n \n\n", "widgetType": "code" } }, { "id": "scene_nyqpYDSNXz", "stageId": "DZynj92UuU", "title": "课程总结测验", "order": 10, "actions": [ { "id": "action_Hgob6KaW", "type": "speech", "text": "现在来做课程总结小测验,看看这节课的内容掌握得怎么样。请独立尝试每一道题,提交后我会和你一起逐题回顾分析。" } ], "outlineId": "scene_10", "createdAt": 1786856253251, "updatedAt": 1786856253251, "type": "quiz", "content": { "type": "quiz", "questions": [ { "id": "q1", "type": "single", "question": "在Python中,以下哪个数据类型最适合用来存储一个学生的姓名和对应的年龄信息?", "options": [ { "value": "A", "label": "列表(list)" }, { "value": "B", "label": "元组(tuple)" }, { "value": "C", "label": "字典(dict)" }, { "value": "D", "label": "集合(set)" } ], "answer": [ "C" ], "analysis": "字典(dict)以键值对形式存储数据,适合存储姓名和年龄这种一一对应的信息。列表和元组只能按顺序存储多个值,集合不能存储键值对。", "points": 10, "hasAnswer": true }, { "id": "q2", "type": "single", "question": "运行以下Python代码后,屏幕上会依次显示哪些数字?\nfor i in range(1, 4):\n print(i)", "options": [ { "value": "A", "label": "1 2 3" }, { "value": "B", "label": "1 2 3 4" }, { "value": "C", "label": "0 1 2" }, { "value": "D", "label": "2 3" } ], "answer": [ "A" ], "analysis": "range(1, 4)从1开始到4之前结束,生成1、2、3。循环依次打印每个数字,所以屏幕上依次显示1、2、3。", "points": 10, "hasAnswer": true }, { "id": "q3", "type": "multiple", "question": "关于Python中的列表(list)和字典(dict),以下哪些说法是正确的?(多选)", "options": [ { "value": "A", "label": "列表是有序的,可以通过索引访问元素" }, { "value": "B", "label": "字典中的键必须是唯一的" }, { "value": "C", "label": "列表只能存储数字类型的数据" }, { "value": "D", "label": "字典的元素可以通过append()方法添加" } ], "answer": [ "A", "B" ], "analysis": "A正确:列表是有序的,支持索引访问。B正确:字典的键必须唯一,否则后面的会覆盖前面的。C错误:列表可以存储任意类型的数据。D错误:append()是列表的方法,字典添加键值对通常使用赋值或update()方法。", "points": 15, "hasAnswer": true }, { "id": "q4", "type": "single", "question": "在Python中,定义函数时需要使用哪个关键字?", "options": [ { "value": "A", "label": "def" }, { "value": "B", "label": "function" }, { "value": "C", "label": "define" }, { "value": "D", "label": "fun" } ], "answer": [ "A" ], "analysis": "Python中定义函数使用def关键字,后面跟函数名和参数列表。function、define、fun都不是Python定义函数的关键字。", "points": 10, "hasAnswer": true }, { "id": "q5", "type": "short_answer", "question": "请用中文解释什么是函数(function),并说明在程序中使用函数的好处。最后请写出一个简单的Python函数示例(可以只写代码,也可以加上解释)。", "commentPrompt": "评分标准:(1)正确解释函数的概念:函数是一段可重复使用的代码块,用于完成特定任务,占40%;(2)至少说出两个使用函数的好处,如复用代码、模块化、易于维护、减少重复等,占30%;(3)给出一个正确的Python函数定义示例(包含def关键字、函数名、括号、冒号、函数体),占30%。如果学生没有写出代码,但前两部分正确,可给至多70%的分。", "analysis": "参考答案:函数是一段有名字的、可重复调用的代码块,用于完成特定任务。好处包括:避免代码重复,提高代码复用性;使程序结构清晰,易于理解和维护;便于调试和修改。示例:def greet(name):\n print('你好, ' + name)\n调用greet('小明')会输出'你好, 小明'。", "points": 20, "hasAnswer": false } ] } } ], "createdAt": "2026-08-16T04:57:33.260Z" }