Последовательность, входные и выходные данные
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.

print("Wake up")
print("Brush teeth")
print("Go to school")
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.
print("Hello, world!")
print("IGCSE Computer Science")
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.
name = input()
print("Hello, " + name)
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.
age = int(input())
print(age + 1)
In the exam: pseudocode
- The same idea in Cambridge pseudocode uses
INPUTandOUTPUT.
OUTPUT "What is your name?"
INPUT Name
OUTPUT "Hello, ", Name
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.
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.
Нажмите Запустить, чтобы увидеть результат здесь.