What computing is · 什么是计算
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · 此页面需较新浏览器(支持 SharedArrayBuffer)。请升级 Chrome、Edge、Firefox 或 Safari 至最新版本。
English
Welcome to AP CSP
- This is AP Computer Science Principles — the big ideas of computing.
- You already learned Python in the basics course. Here we use it for AP ideas.
- Some lessons are reading only. Others let you run code. Read each step, then press Continue.
中文
欢迎来到 AP CSP
- 这是 AP 计算机科学原理 —— 计算机科学的核心思想。
- 你已经在基础课程里学过 Python。在这里我们用它来学习 AP 的概念。
- 有些课只需要阅读,有些课可以运行代码。读完每一步,然后按继续。
English
Every program has a purpose
- A program is a set of instructions a computer follows.
- Every program is made for a reason — to solve a problem or help people.
- Example purposes: send a message, play a song, find the shortest road.
中文
每个程序都有目的
- 程序是一组计算机要执行的指令。
- 每个程序都是为了某个原因而写的 —— 解决一个问题或帮助人们。
- 例如:发送一条消息、播放一首歌、找到最短的道路。
English
Input → process → output
- Most programs work in three steps.
- Input: data goes in (a number you type, a tap, a file).
- Process: the program does work on that data.
- Output: a result comes out (text on the screen, a sound, a saved file).
中文
输入 → 处理 → 输出
- 大多数程序分三步工作。
- 输入(input):数据进来(你输入的数字、一次点击、一个文件)。
- 处理(process):程序对这些数据做处理。
- 输出(output):结果出来(屏幕上的文字、一段声音、保存的文件)。
INPUT PROCESS OUTPUT
"5" -> add 5 and 3 -> "8"
English
A tiny example
- This program takes an input (a name), does a small process, and shows an output.
- You do not need to write it now — just read it and find the three steps.
中文
一个小例子
- 这个程序接收一个输入(名字),做一点小处理,然后显示输出。
- 你现在不用写它 —— 只要读一读,找出这三个步骤。
name = input("Your name: ") # input
greeting = "Hello, " + name # process
print(greeting) # output
English
Design is a cycle
- Good programs are not written perfectly the first time.
- We use an iterative cycle: do it again and again, a little better each time.
- Plan → write → test → improve, then repeat.
中文
设计是一个循环
- 好的程序不是第一次就写得完美的。
- 我们使用一个迭代(iterative)循环:一遍又一遍地做,每次都好一点。
- 计划 → 编写 → 测试 → 改进,然后重复。
plan ──> write ──> test ──> improve
^ │
└──────────────────────────────┘
English
Errors are normal
- An error (a bug) is a mistake that makes the program do the wrong thing.
- In the basics course you learned to debug: read the message, find the line, fix it.
- Finding and fixing bugs is a normal part of every step in the cycle.
中文
出错是正常的
- 错误(bug)是让程序做错事的一个小毛病。
- 在基础课程里你学过调试(debug):读报错信息、找到那一行、改正它。
- 找出并修复 bug 是循环中每一步都很正常的一部分。
English
Computing is collaborative
- Most real programs are built by a team, not one person.
- People share ideas, split the work, and check each other's code.
- Different people bring different views, which makes the program better.
中文
计算是协作的
- 大多数真实的程序是由一个团队完成的,而不是一个人。
- 人们分享想法、分配工作、互相检查代码。
- 不同的人带来不同的视角,这让程序变得更好。
English
Common mistakes
- Computing is problem-solving with data, not just typing code.
- An algorithm is a clear, finite sequence of steps.
中文
常见错误
- 计算是用数据解决问题,不只是敲代码。
- 算法是一串清晰、有限的步骤。
English
What is next
- This course follows the 5 Big Ideas of AP CSP: Creative Development, Data, Algorithms & Programming, Computer Systems & Networks, and the Impact of Computing.
- Next lesson we look at bits and binary — how computers store data with 0s and 1s.
- First, try the small task below — take an input, process it, and print the output, just like the example above.
中文
接下来
- 这门课遵循 AP CSP 的 5 个大概念:创意开发 Creative Development、数据 Data、算法与编程 Algorithms & Programming、计算机系统与网络 Computer Systems & Networks,以及计算的影响 Impact of Computing。
- 下一课我们看比特与二进制 —— 计算机如何用 0 和 1 来存储数据。
- 先试试下面的小任务 —— 取得输入、处理它、打印输出,就像上面的例子那样。
Explore · 探索
Input → process → output · 输入 → 处理 → 输出
Every computation takes input · 输入, processes it, and gives output · 输出. · 每个计算都是:取得输入、处理、给出输出。
Try the three steps yourself. The input · 输入 is already given as the variable name. Process it into a greeting, then output · 输出 it: print Hello, followed by the name. · 自己来走一遍这三步。输入已经作为变量 name 给好了。把它处理成一句问候,然后输出:打印 Hello, 加上这个名字。
Click Run to see the output here. · 点击“运行”查看此处输出。