Skip to content

Commit 5962094

Browse files
committed
feat: update chapter(s) by CAT
1 parent 118a03f commit 5962094

File tree

14 files changed

+280
-52
lines changed

14 files changed

+280
-52
lines changed

content/chapter-10/1000.md

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ Another popular reason to learn programming is to create games. For that reason,
2929

3030
***
3131

32+
### 本章目录
33+
3234
* 10.1 Game programs
3335
* 10.2 Adding randomness
3436
* 10.3 Example 1: Bulls and Cows
@@ -44,15 +46,21 @@ Another popular reason to learn programming is to create games. For that reason,
4446

4547
<!-- -->
4648

47-
10.1 游戏程序设计
48-
10.2 加入随机性
49-
10.3 示例一:公牛与奶牛游戏
50-
10.3.1 游戏的运行机制
51-
10.3.2 采用自顶向下的设计策略
52-
10.3.3 参数及返回值的类型
53-
10.3.4 实施我们的功能
54-
10.3.5 为公牛与奶牛游戏增加图形化界面
55-
10.4 示例二:Bogart 游戏
56-
10.4.1 游戏的运行机制
57-
10.4.2 采用自顶向下的设计策略
58-
10.4.3 实施我们的功能
49+
* 10.1 游戏程序设计
50+
* 10.2 加入随机性
51+
* 10.3 示例一:公牛与奶牛游戏
52+
* 10.3.1 游戏的运行机制
53+
* 10.3.2 采用自顶向下的设计策略
54+
* 10.3.3 参数及返回值的类型
55+
* 10.3.4 实施我们的功能
56+
* 10.3.5 为公牛与奶牛游戏增加图形化界面
57+
* 10.4 示例二:Bogart 游戏
58+
* 10.4.1 游戏的运行机制
59+
* 10.4.2 采用自顶向下的设计策略
60+
* 10.4.3 实施我们的功能
61+
62+
***
63+
64+
> 本章内容略。如需阅读,请购买正版。
65+
66+
***

content/chapter-10/1005.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
id: 23
3+
title: "[译] [1005] 本章小结"
4+
---
5+
6+
7+
## Summary
8+
## 本章小结
9+
10+
* Games have a common program flow that includes game setup and gameplay.
11+
* Randomness is an important ingredient of many games.
12+
* We can add randomness to our Python games by using functions in the random module.
13+
* We can implement games with Copilot using the same workflow that we’ve used throughout the book, with problem decomposition playing a key role.
14+
15+
<!-- -->
16+
17+
* 所有游戏都遵循一种共通的程序流程,包括游戏的设置和玩法。
18+
* 随机性是众多游戏不可或缺的一部分。
19+
* 我们可以通过使用 random 模块中的函数,在我们的 Python 游戏中添加随机性。
20+
* 我们可以利用本书中一贯采用的工作流程,通过 Copilot 来实现游戏的开发,问题分解在此过程中扮演关键角色。

content/chapter-11/1100.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ In this final chapter, we want to give you a glimpse of the creative ways people
2424

2525
***
2626

27+
### 本章目录
28+
2729
* 11.1 Prompt patterns
2830
* 11.1.1 Flipped interaction pattern
2931
* 11.1.2 Persona pattern
@@ -33,9 +35,15 @@ In this final chapter, we want to give you a glimpse of the creative ways people
3335

3436
<!-- -->
3537

36-
11.1 提示词模式
37-
11.1.1 翻转互动模式
38-
11.1.2 角色推演模式
39-
11.2 局限与未来走向
40-
11.2.1 Copilot 目前遇到的挑战
41-
11.2.2 Copilot 能被视为一种新的编程语言吗?
38+
* 11.1 提示词模式
39+
* 11.1.1 翻转互动模式
40+
* 11.1.2 角色扮演模式
41+
* 11.2 局限与未来走向
42+
* 11.2.1 Copilot 目前遇到的挑战
43+
* 11.2.2 Copilot 能被视为一种新的编程语言吗?
44+
45+
***
46+
47+
> 本章内容略。如需阅读,请购买正版。
48+
49+
***

content/chapter-11/1103.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
id: 24
3+
title: "[译] [1103] 本章小结"
4+
---
5+
6+
7+
## Summary
8+
## 本章小结
9+
10+
* A prompt pattern is a template to help us construct a prompt to meet a given goal.
11+
* The flipped interaction pattern flips the script: rather than asking questions to the LLM, the LLM asks questions to us.
12+
* The flipped interaction pattern is useful when we don’t know how to effectively prompt the LLM.
13+
* The persona pattern is used to have the AI take on a particular persona, such as “introductory programming instructor,” or point of view.
14+
* The persona pattern is useful when we want the LLM to respond from a given perspective.
15+
* Copilot currently struggles with tasks that are contrived, not well defined, or large.
16+
* Some believe that LLMs will replace programming languages; others believe that programming languages are here to stay.
17+
* LLMs are helping people do data science without those people ever seeing the Python code.
18+
* It may be that programming languages themselves are not replaced, but that the leading languages will be developed to be more readable than today’s languages.
19+
20+
<!-- -->
21+
22+
* 提示词模式是一种模版,旨在帮助我们构建提示词,以实现一个特定目标。
23+
* 翻转互动模式颠覆了常规互动方式:不是我们向 LLM 提问,而是 LLM 向我们提问。
24+
* 当我们不确定如何有效地引导 LLM 时,翻转互动模式特别有用。
25+
* 角色扮演模式使 AI 能够扮演特定的角色,例如“初级编程教师”,或代表一个特定观点。
26+
* 当我们需要 LLM 从一个特定角度进行回应时,角色扮演模式非常有益。

content/chapter-5/500.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ We’re going to continue in this chapter with five more Python features, which
3535

3636
***
3737

38+
### 本章目录
39+
3840
* 5.1 Top 10 programming features you need to know: Part 2
3941
* 5.1.1 #6. Loops
4042
* 5.1.2 #7. Indentation
@@ -50,3 +52,9 @@ We’re going to continue in this chapter with five more Python features, which
5052
* 5.1.3 #8. 字典
5153
* 5.1.4 #9. 文件
5254
* 5.1.5 #10. 模块
55+
56+
***
57+
58+
> 本章内容略。如需阅读,请购买正版。
59+
60+
***

content/chapter-5/502.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
id: 18
3+
title: "[译] [502] 本章小结"
4+
---
5+
6+
7+
## Summary
8+
## 本章小结
9+
10+
* A loop is used to repeat code as many times as needed.
11+
* We use a `for` loop when we know how many iterations the loop will do; we use a while loop when we don’t know how many iterations a loop will do.
12+
* Python uses indentation to determine which lines of code go together.
13+
* A dictionary is a mapping from keys (such as words) to values (such as their frequencies).
14+
* We need to open a file before we can read from it.
15+
* Once a file is open, we can use methods or a loop to read its lines.
16+
* Some modules (such as csv and zipfile) come with Python and can be used by importing them.
17+
* Other modules, such as matplotlib, need to be installed first before they can be imported and used.
18+
19+
<!-- -->
20+
21+
* 循环用于根据需要重复执行代码多次。
22+
* 当我们明确知道循环将执行的迭代次数时,使用 `for` 循环;而在不确定循环将执行多少次迭代时,则采用 while 循环。
23+
* Python 通过缩进来判断哪些代码行应该组合在一起。
24+
* 字典是从键(例如单词)到值(例如它们的频率)的映射。
25+
* 我们必须先打开一个文件,才能开始从中读取数据。
26+
* 文件打开后,我们可以使用方法或循环来逐行读取。
27+
* 一些模块(如 csv 和 zipfile)是 Python 自带的,可以直接通过导入来使用。
28+
* 其他模块,例如 matplotlib,需先安装之后才能导入和使用。

content/chapter-6/600.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ In Chapter 3, we first started to see the importance of testing the code produce
2727

2828
***
2929

30+
### 本章目录
31+
3032
* 6.1 Why it is crucial to test code
3133
* 6.2 Closed-box and open-box testing
3234
* 6.2.1 Closed-box testing
@@ -68,3 +70,9 @@ In Chapter 3, we first started to see the importance of testing the code produce
6870
* 6.6.2 函数创建
6971
* 6.6.3 函数测试
7072
* 6.6.4 `doctest` 面临的常见问题
73+
74+
***
75+
76+
> 本章内容略。如需阅读,请购买正版。
77+
78+
***

content/chapter-6/607.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
id: 19
3+
title: "[译] [607] 本章小结"
4+
---
5+
6+
7+
## Summary
8+
## 本章小结
9+
10+
* Testing is a critical skill when writing software using Copilot.
11+
* Closed-box and open-box testing are different approaches to ensuring the code is correct. In closed-box testing, we come up with test cases based on what we know about the problem; in open-box testing, we additionally examine the code itself.
12+
* Doctest is a convenient way to test your code by adding test cases to the docstring description of a function.
13+
* Creating artificial files is an effective way to test code that uses files.
14+
15+
<!-- -->
16+
17+
* 在利用 Copilot 进行软件开发时,测试技能至关重要。
18+
* 黑盒测试与白盒测试代表了确保代码准确性的两种不同策略。黑盒测试依据我们对问题的认识来设计测试案例;而在白盒测试中,我们会进一步审视代码本身。
19+
* Doctest 提供了一种方便的方法,可以通过在函数的文档字符串说明中加入测试案例来对代码进行测试。
20+
* 创造虚拟文件是测试涉及文件操作代码的一个高效策略。

content/chapter-7/700.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ In this chapter, we will learn how to break large problems into smaller ones. We
3737

3838
***
3939

40+
### 本章目录
41+
4042
* 7.1 Problem decomposition
4143
* 7.2 Small examples of top-down design
4244
* 7.3 Authorship identification
@@ -49,12 +51,18 @@ In this chapter, we will learn how to break large problems into smaller ones. We
4951

5052
<!-- -->
5153

52-
7.1 问题分解
53-
7.2 自顶向下设计的示例
54-
7.3 作者身份识别
55-
7.4 应用自顶向下设计识别作者身份
56-
7.5 分解子问题过程
57-
7.5.1 解析神秘书籍的签名
58-
7.6 自顶向下设计的总结
59-
7.7 实现具体函数
60-
7.8 更进一步
54+
* 7.1 问题分解
55+
* 7.2 自顶向下设计的示例
56+
* 7.3 作者身份识别
57+
* 7.4 应用自顶向下设计识别作者身份
58+
* 7.5 分解子问题过程
59+
* 7.5.1 解析神秘书籍的签名
60+
* 7.6 自顶向下设计的总结
61+
* 7.7 实现具体函数
62+
* 7.8 更进一步
63+
64+
***
65+
66+
> 本章内容略。如需阅读,请购买正版。
67+
68+
***

content/chapter-7/709.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
id: 20
3+
title: "[译] [709] 本章小结"
4+
---
5+
6+
7+
## Summary
8+
## 本章小结
9+
10+
* We need to divide a big programming problem into smaller sub-problems before we can effectively implement it.
11+
* Top-down design is a systematic technique for breaking a problem down into small subtask functions.
12+
* In top-down design, we seek small functions that solve well-defined tasks and that can be used by one or more other functions.
13+
* Author identification is the process of guessing the author of a mystery book.
14+
* We can use features about words (e.g., average word length) and sentences (e.g., average number of words per sentence) to characterize how each known author writes.
15+
* Machine learning is an important area of computer science that investigates how machines can learn from data and make predictions.
16+
* In supervised learning, we have some training data in the form of objects (e.g., books) and their categories (who wrote each book). We can learn from that data to make predictions about new objects.
17+
* A signature consists of a list of features, one signature per object.
18+
* When we’re ready to implement our functions that arose from top-down design, we implement them from the bottom up; that is, we implement the leaf functions first, then functions that depend on those leaf functions, and so on until we implement the topmost function.
19+
* Refactoring code means to improve the design of the code (e.g., by reducing code repetition).
20+
21+
<!-- -->
22+
23+
* 在有效实施一个庞大编程任务之前,我们需要将其划分为更细小的子问题。
24+
* 自顶向下设计是一个系统化技巧,用于把复杂问题拆解为多个小的子任务函数。
25+
* 在自顶向下设计策略中,我们寻求那些能够解决具体任务并能被其他函数复用的小型函数。
26+
* 作者识别是推测一部未知书籍作者的过程。
27+
* 通过分析词语(例如,平均词长)和句子(例如,平均每句话的词数)的特性,我们能够描绘出每位已知作者的写作风格。
28+
* 机器学习是计算机科学中的一个重要分支,它研究机器如何通过数据学习并进行预测。
29+
* 在监督学习场景下,我们有一些训练数据,这些数据以对象(如书籍)及其分类(例如,每本书的作者)的形式存在。我们可以利用这些数据来对新的对象进行预测。
30+
* 一个签名包括了一组特征,每个对象配有一个独特的签名。
31+
* 当我们开始根据自顶向下的设计准备实现我们的功能时,我们采用自底向上的实现方式;也就是说,我们首先实施最基础的叶子功能,然后是依赖这些叶子功能的更高层次的功能,依次类推,直至实现最高层的功能。
32+
* 重构代码旨在提升代码设计的质量(例如,通过降低代码冗余)。

0 commit comments

Comments
 (0)