רצף, קלט ופלט
עמוד זה דורש דפדפן עדכני (תומך ב-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.
לחץ על הרץ כדי לראות את התוצא כאן.