diff --git a/.vitepress/theme/custom.css b/.vitepress/theme/custom.css new file mode 100644 index 0000000..dd0f80c --- /dev/null +++ b/.vitepress/theme/custom.css @@ -0,0 +1,3 @@ +:lang(zh) { + --vp-code-copy-copied-text-content: '已复制' + } \ No newline at end of file diff --git a/.vitepress/theme/index.ts b/.vitepress/theme/index.ts index 55afef1..4f9e42b 100644 --- a/.vitepress/theme/index.ts +++ b/.vitepress/theme/index.ts @@ -3,6 +3,7 @@ import DefaultTheme from "vitepress/theme" import BVideo from "./components/BVideo.vue" import Author from "./components/Author.vue" import CodeEditor from "./components/CodeEditor.vue" +import './custom.css' export default { extends: DefaultTheme, diff --git a/basic/tasks/pythontutor/image-12.png b/basic/tasks/pythontutor/image-12.png new file mode 100644 index 0000000..76ddbdd Binary files /dev/null and b/basic/tasks/pythontutor/image-12.png differ diff --git a/basic/tasks/pythontutor/image-3.png b/basic/tasks/pythontutor/image-3.png new file mode 100644 index 0000000..c33d5c7 Binary files /dev/null and b/basic/tasks/pythontutor/image-3.png differ diff --git a/basic/tasks/pythontutor/image-6.png b/basic/tasks/pythontutor/image-6.png new file mode 100644 index 0000000..ac0f614 Binary files /dev/null and b/basic/tasks/pythontutor/image-6.png differ diff --git a/basic/tasks/pythontutor/image-7.png b/basic/tasks/pythontutor/image-7.png new file mode 100644 index 0000000..de83abd Binary files /dev/null and b/basic/tasks/pythontutor/image-7.png differ diff --git a/basic/tasks/pythontutor/image-8.png b/basic/tasks/pythontutor/image-8.png new file mode 100644 index 0000000..668c656 Binary files /dev/null and b/basic/tasks/pythontutor/image-8.png differ diff --git a/basic/tasks/pythontutor/image-9.png b/basic/tasks/pythontutor/image-9.png new file mode 100644 index 0000000..07213ab Binary files /dev/null and b/basic/tasks/pythontutor/image-9.png differ diff --git a/basic/tasks/pythontutor/image.png b/basic/tasks/pythontutor/image.png new file mode 100644 index 0000000..aa0eca3 Binary files /dev/null and b/basic/tasks/pythontutor/image.png differ diff --git a/basic/tasks/pythontutor/index.md b/basic/tasks/pythontutor/index.md new file mode 100644 index 0000000..e4ad499 --- /dev/null +++ b/basic/tasks/pythontutor/index.md @@ -0,0 +1,60 @@ +# 调试并记录 + +## [前提自学](/basic/tips/pythontutor/) + +现在需要记录每次的调试过程,分别需要记录: + +1. 初始值 + +2. 循环的条件 + +3. 条件的值 + +4. 计数器每次加的值 + +5. 循环的次数 + +每一项所对应的代码,如图: + +![0](image.png) + +每次填写后,刷新网页再次填写。 + +打开:[https://lc.xuyue.cc/public-forms/do0zqi0xlpe](https://lc.xuyue.cc/public-forms/do0zqi0xlpe) + + +## 第一步 两人一组,一人负责调试,一人负责记录 + +![6](image-6.png) + +## 第二步 修改一次代码,调试并记录 + +你可以选择以下其中一种,修改代码,调试并记录。 + +1. 修改初始值,举个例子,从初始值 0 改为 2 + +![3](image-3.png) + +2. 修改循环的条件,举个例子,从小于改为小于等于 + +![7](image-7.png) + +3. 修改条件的数值,举个例子,从 5 改为 10 + +![8](image-8.png) + +4. 修改计数器每次加的数,举个例子,从 1 改为 2 + +![9](image-9.png) + +## 第三步 在自测猫中修改代码,记录 + +打开:[https://code.xuyue.cc/?query=5](https://code.xuyue.cc/?query=5) + +每次修改【初始值、循环的条件、条件的值、计数器每次加的值】,运行查看循环次数,并记录。 + +比如: + +![12](image-12.png) + +每组至少记录 5 份。 diff --git a/basic/tips/pythontutor/PixPin_2024-12-19_11-19-48.gif b/basic/tips/pythontutor/PixPin_2024-12-19_11-19-48.gif deleted file mode 100644 index fb3f37c..0000000 Binary files a/basic/tips/pythontutor/PixPin_2024-12-19_11-19-48.gif and /dev/null differ diff --git a/basic/tips/pythontutor/PixPin_2024-12-19_11-22-54.gif b/basic/tips/pythontutor/PixPin_2024-12-19_11-22-54.gif deleted file mode 100644 index 0faee7c..0000000 Binary files a/basic/tips/pythontutor/PixPin_2024-12-19_11-22-54.gif and /dev/null differ diff --git a/basic/tips/pythontutor/PixPin_2024-12-19_11-26-35.gif b/basic/tips/pythontutor/PixPin_2024-12-19_11-26-35.gif deleted file mode 100644 index ad3485a..0000000 Binary files a/basic/tips/pythontutor/PixPin_2024-12-19_11-26-35.gif and /dev/null differ diff --git a/basic/tips/pythontutor/PixPin_2024-12-19_19-45-49.gif b/basic/tips/pythontutor/PixPin_2024-12-19_19-45-49.gif new file mode 100644 index 0000000..f76ceae Binary files /dev/null and b/basic/tips/pythontutor/PixPin_2024-12-19_19-45-49.gif differ diff --git a/basic/tips/pythontutor/PixPin_2024-12-19_19-54-46.gif b/basic/tips/pythontutor/PixPin_2024-12-19_19-54-46.gif new file mode 100644 index 0000000..9119180 Binary files /dev/null and b/basic/tips/pythontutor/PixPin_2024-12-19_19-54-46.gif differ diff --git a/basic/tips/pythontutor/PixPin_2024-12-19_19-58-47.gif b/basic/tips/pythontutor/PixPin_2024-12-19_19-58-47.gif new file mode 100644 index 0000000..98c65a9 Binary files /dev/null and b/basic/tips/pythontutor/PixPin_2024-12-19_19-58-47.gif differ diff --git a/basic/tips/pythontutor/image-3.png b/basic/tips/pythontutor/image-3.png deleted file mode 100644 index eca38bd..0000000 Binary files a/basic/tips/pythontutor/image-3.png and /dev/null differ diff --git a/basic/tips/pythontutor/image-4.png b/basic/tips/pythontutor/image-4.png index 394f4a4..170061f 100644 Binary files a/basic/tips/pythontutor/image-4.png and b/basic/tips/pythontutor/image-4.png differ diff --git a/basic/tips/pythontutor/image-6.png b/basic/tips/pythontutor/image-6.png deleted file mode 100644 index 53e07e5..0000000 Binary files a/basic/tips/pythontutor/image-6.png and /dev/null differ diff --git a/basic/tips/pythontutor/image-7.png b/basic/tips/pythontutor/image-7.png deleted file mode 100644 index 738c55b..0000000 Binary files a/basic/tips/pythontutor/image-7.png and /dev/null differ diff --git a/basic/tips/pythontutor/image-8.png b/basic/tips/pythontutor/image-8.png deleted file mode 100644 index 3161787..0000000 Binary files a/basic/tips/pythontutor/image-8.png and /dev/null differ diff --git a/basic/tips/pythontutor/image-9.png b/basic/tips/pythontutor/image-9.png deleted file mode 100644 index 590d796..0000000 Binary files a/basic/tips/pythontutor/image-9.png and /dev/null differ diff --git a/basic/tips/pythontutor/image.png b/basic/tips/pythontutor/image.png deleted file mode 100644 index 0962ce0..0000000 Binary files a/basic/tips/pythontutor/image.png and /dev/null differ diff --git a/basic/tips/pythontutor/index.md b/basic/tips/pythontutor/index.md index 3d752cc..dd0f526 100644 --- a/basic/tips/pythontutor/index.md +++ b/basic/tips/pythontutor/index.md @@ -1,81 +1,64 @@ -# 使用 [pythontutor.com](https://pythontutor.com/) 可视化的执行流程 +# 可视化执行流程 -![0](image.png) +如图演示,我们可以精确控制代码的执行流程。 -由于网站都是英文的,所以接下来我会一步步的截图,请按照顺序执行 +![0](PixPin_2024-12-19_19-54-46.gif) -## 1. 选择编程语言 +打开 [pythontutor.com](https://pythontutor.com/),由于网站都是英文的,所以接下来我会一步步的截图,请按照顺序执行。 + +## 第一步 选择编程语言 ![1](image-1.png) -## 2. 在输入框中粘贴代码 - +## 第二步 在输入框中粘贴代码 ![2](image-2.png) ```py -n=1 i=0 while i<5: i=i+1 - n=n*2 - print(n) + print(i) ``` -## 3. 点击【可视化执行】按钮 +## 第三步 点击【可视化执行】按钮 ![5](image-5.png) -## 4. 进入调试页面 +## 第四步 进入调试页面 ![4](image-4.png) -① 绿色箭头表示【当前正在】执行的语句 +① 点击下一步 -② 红色箭头表示【接下来要】执行的语句 +② 绿色箭头表示【当前正在】执行的语句,红色箭头表示【下一步要】执行的语句 -③ 输出结果 +③ 显示变量的值 -④ 显示变量的值 +④ 输出的内容 -## 5. 基础调试 +## 第五步 调试代码 -![3](image-3.png) +![1](PixPin_2024-12-19_19-45-49.gif) -5.1 不断点击 ①【Next 下一步】按钮 +5.1 不断点击【Next】按钮 -5.2 代码左侧 ② 出现绿色和红色箭头,指向【当前】和【接下来】的执行语句。 +5.2 ① 注意【绿色】和【红色】箭头的走动 -5.3 右侧 ③ 实时展示变量的值 +5.3 ② 变量的值随着代码的执行而发生变化 -**注意观察箭头的走向和变量值的变化** +5.4 ③ 输出内容的变化 -![1](PixPin_2024-12-19_11-19-48.gif) +**注意观察箭头的行走和值的变化** -## 6. 拖动进度条 * - -可以拖动进度条反复查看,或者点击【First】跳到第一步,【Last】直接跳到最后一步 - -![2](PixPin_2024-12-19_11-22-54.gif) - -## 7. 更改代码再次调试 +## 第六步 更改代码再次调试 点击【Edit this code】按钮可以修改代码 -![3](PixPin_2024-12-19_11-26-35.gif) - -**可以更改 i 的初始值 i=?,条件符号,条件值,计数器 i=i+? 等** - -![6](image-6.png) - -比如: - -![7](image-7.png) - -![8](image-8.png) - -![9](image-9.png) +![2](PixPin_2024-12-19_19-58-47.gif) 遇到弹框,直接点按钮 ![10](image-10.png) + +## [完成任务](/basic/tasks/pythontutor/) \ No newline at end of file