Skip to content

Commit 36eee0d

Browse files
committed
feat: update chapter(s) by CAT
1 parent ac5d2aa commit 36eee0d

File tree

3 files changed

+36
-11
lines changed

3 files changed

+36
-11
lines changed

content/chapter-4/400.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,36 @@
11
---
2-
id:
3-
title: "[译] [400] 第四章 阅读 Python 代码(上)"
2+
id: 25
3+
title: "[译] [400] 第四章 理解 Python 代码(上)"
44
---
55

66
# 4 Reading Python Code: Part 1
7-
# 第四章 阅读 Python 代码(上)
7+
# 第四章 理解 Python 代码(上)
88

99
### This chapter covers
1010
### 本章内容概要
1111

1212
* Why knowing how to read code is important
1313
* How to ask Copilot to explain code
14-
* Using functions to break a problem into smaller subproblems
14+
* Using functions to break a problem into smaller sub-problems
1515
* Using variables to hang on to values
16-
* Using if-statements to make decisions
16+
* Using `if` statements to make decisions
1717
* Using strings to store and manipulate text
1818
* Using lists to collect and manipulate many values
1919

20-
In Chapter 3, we used Copilot to write several functions for us. What are they good for? Maybe our money_made function could be part of a stock trading system. Maybe our is_strong_password function could be used as part of a social network website. Maybe our best_word function could be used as part of some Scrabble AI. Overall, we’ve written some useful functions that could be part of larger programs. And we did this without writing much code ourselves or, indeed, understanding what the code even does.
20+
<!-- -->
21+
22+
* 为什么懂得如何阅读代码很重要
23+
* 如何让 Copilot 解释代码
24+
* 利用函数把问题拆分成若干更小的子问题
25+
* 利用变量保存数据
26+
* 利用 `if` 语句进行决策
27+
* 利用字符串来存储及处理文本
28+
* 利用列表来收集和处理多个值
29+
30+
In Chapter 3, we used Copilot to write several functions for us. What are they good for? Maybe our `money_made` function could be part of a stock trading system. Maybe our `is_strong_password` function could be used as part of a social network website. Maybe our `best_word` function could be used as part of some Scrabble AI. Overall, we’ve written some useful functions that could be part of larger programs. And we did this without writing much code ourselves or, indeed, understanding what the code even does.
31+
32+
在第三章,我们借助 Copilot 编写了几个有用的函数。这些函数能用在哪里呢?例如,我们的 `money_made` 函数可能成为股票交易系统的一部分;`is_strong_password` 函数可以用于社交网站的密码强度检测;`best_word` 函数则可能应用于 Scrabble 游戏的 AI 中。归根结底,我们编写了若干可以成为大型程序组成部分的实用函数,而这一切几乎不需要我们自己动手编写代码,或者完全理解这些代码的具体作用。
2133

2234
However, we believe that you need to understand at a high-level what code does and that this will require some time to learn, hence we’ve split this across two chapters. In this chapter, we’ll explain why reading code is important and introduce you to a Copilot labs feature that can help you understand the code. After that, we'll dive into the top ten programming features you’ll need to be able to recognize in order to read most basic code produced by Copilot. We’ll do the first five in this chapter and the remaining five in the next chapter. Don't worry: you've actually been informally introduced to all ten already—we're just going to deepen your understanding of each one.
35+
36+
然而,我们相信你需要从高层次理解代码的作用,这将需要一些时间来学习,因此我们将这部分内容分为两章。在本章中,我们将解释为什么阅读代码是重要的,并介绍一个 Copilot 实验室的特性,该特性能帮助你理解代码。之后,我们会深入讨论十个编程特性,这些特性对于阅读 Copilot 产出的大多数基础代码来说是必需认识的。我们会在本章介绍前五个特性,在下一章介绍剩余的五个。不用担心:你其实已经非正式地了解了这十个特性——我们只是要深化你对它们每一个的理解。

content/chapter-4/404.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
id:
3-
title: "[译] [XXX] XXXXXXXXXXXXXXXX"
2+
id: 26
3+
title: "[译] [404] 本章小结"
44
---
55

66

7-
## 4.4 Summary
8-
## 4.4 本章小结
7+
## Summary
8+
## 本章小结
99

1010
* We need to be able to read code to determine whether it is correct, test it effectively, and write our own code when needed.
1111
* The Copilot Labs Extension can provide line-by-line explanations of code to explain to you what the code is doing.
@@ -21,3 +21,14 @@ title: "[译] [XXX] XXXXXXXXXXXXXXXX"
2121

2222
<!-- -->
2323

24+
* 能够阅读代码是判断代码是否正确、有效测试代码,以及在需要时编写自己代码的关键能力。
25+
* Copilot 实验室扩展能提供代码的逐行解释,向你阐明代码的具体操作。
26+
* Python 具有像 `max``input``print` 这样的内置函数,我们调用这些函数的方式就像调用我们自己定义的函数一样。
27+
* 变量是引用值的名字。
28+
* 赋值语句让变量指向了一个具体的值。
29+
* `if` 语句用于让我们的程序进行决策,并选择多条路径中的一条继续执行。
30+
* 字符串用来存储和操作文本。
31+
* 方法是与特定类型相关的函数。
32+
* 列表用来存储和操作一系列值(比如数字序列或字符串序列)。
33+
* 字符串或列表中的每个值都对应一个索引,这个索引从 0 开始计数,而不是从 1 开始。
34+
* 字符串是不可变的(不可以修改);而列表是可变的(可以修改)。

content/chapter-5/500.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: "[译] [500] 第五章 阅读 Python 代码(下)"
44
---
55

66
# 5 Reading Python Code: Part 2
7-
# 第五章 阅读 Python 代码(下)
7+
# 第五章 理解 Python 代码(下)
88

99
### This chapter covers
1010
### 本章内容概要

0 commit comments

Comments
 (0)