此页面需较新浏览器(支持 SharedArrayBuffer)。请升级 Chrome、Edge、Firefox 或 Safari 至最新版本。
English
A program runs in order
- A program is a list of steps.
- Python runs them from top to bottom, one at a time.
- This order is called sequence — the first idea in the syllabus.

English
print("Wake up")
print("Brush teeth")
print("Go to school")
English
OUTPUT becomes print()
- In the exam, OUTPUT shows something on the screen.
- In Python, that is
print(). - The text inside the quotes is printed, then a new line starts.
English
print("Hello, world!")
print("IGCSE Computer Science")
English
INPUT becomes input()
- In the exam, INPUT reads what the user types.
- In Python, that is
input(). - It always gives back a string (text), even if the user types digits.
English
name = input()
print("Hello, " + name)
English
Turn input into a number
input()gives text, so"5"is not the number 5.- Wrap it with
int()to get a whole number. - Now you can do maths with it.
English
age = int(input())
print(age + 1)
English
In the exam: pseudocode
- The same idea in Cambridge pseudocode uses
INPUTandOUTPUT.
OUTPUT "What is your name?"
INPUT Name
OUTPUT "Hello, ", Name
English
Common mistakes
- Statements run from top to bottom, in the order you write them.
input()gives back text (a string); useint(...)when you need a number.
English
Now you try
- Use
print()to show output. - Use
input()to read a line — leave the brackets empty here. - Press Check answer to test your code.
探索
输入 → 处理 → 输出
大多数程序都遵循一个模式:取得输入、做处理、显示输出。
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
按顺序打印这三行:先 Ready,再 Set,最后 Go —— 每行一个。
点击“运行”查看此处输出。
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
用 input() 读取一个名字,然后输出 Hello, 、名字,再加 !。当输入为 Sam 时,应输出 Hello, Sam!。
点击“运行”查看此处输出。
难度 1/5 · 今日首次完成可获 100 金币及少量额外奖励
用 input() 读取一个整数,用 int(...) 转换,然后打印它的两倍(乘以 2)。当输入为 6 时,应输出 12。
点击“运行”查看此处输出。