Sequence, input & output · רצף, קלט ופלט
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.
תוכנית פועלת בסדר
- תוכנית היא רשימה של שלבים.
- Python מבצע אותם מ-מעלה למטה, אחד אחר השני.
- סדר זה נקרא רצף — הרעיון הראשון בתוכנית הלימודים.
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()
- בבחינה, הפלט מציג מידע על המסך.
- ב-Python, זהו
print(). - הטקסט בתוך הסימוני הערבייה מודפס, ולאחר מכן מתחיל שורה חדשה.
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.
INPUT הופך ל-input()
- במבחן, INPUT קורא מה שמשתמש הקליד.
- ב-Python, זהו
input(). - הוא תמיד מחזיר מחרוזת (טקסט), גם אם המשתמש הקליד ספרות.
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.
הפיכת התפוקה למספר
input()נותן טקסט, לכן"5"אינו המספר 5.- עטוף אותו ב-
int()כדי לקבל מס שלם. - עכשיו ניתן לבצע חשבון איתו.
age = int(input())
print(age + 1)
In the exam: pseudocode
- The same idea in Cambridge pseudocode uses
INPUTandOUTPUT.
במבחן: פסאו-קוד
- אותה רעיון בפסאו-קוד של Cambridge משתמש ב
INPUTובOUTPUT.
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.
טעויות נפוצות
- ההגדרות מוצאות לפועל מעלה למטה, בסדר שכתבת.
input()מחזיר טקסט (מחרוזת); השתמש בint(...)כשאתה זקוק למספר.
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.
כעת תנסו בעצמכם
- השתמש ב
print()להצגת תפוקה. - השתמש ב
input()לקריאת שורה — השאר את הסוגריים ריקים כאן. - לחץ על בדוק תשובה כדי לבדוק את הקוד שלך.
Input → process → output · כניסה → עיבוד → תוצאה
Most programs follow one shape: get input, do something, show output. · לרוב התוכניות עוקבות אחרי דגם אחד: קבל קלט, בצע פעולה, הצג פלט.
Print these three lines, in order: Ready, then Set, then Go — one per line. · הדפס שלוש שורות אלו, בהסדר: Ready, ואז Set, ואז Go — כל שורה בנפרד.
Click Run to see the output here. · לחץ על הרץ כדי לראות את התוצא כאן.
Read a name with input(), then print Hello, then the name then !. For the input Sam, the output should be Hello, Sam!. · קרא שם עם input(), ולאחר מכן הדפס ⟨⟩Hello, , ולאחריו את השם, ולאחריו ⟨⟩!. עבור הקלט ⟨⟩Sam, התוצאה צריכה להיות ⟨⟩Hello, Sam!.
Click Run to see the output here. · לחץ על הרץ כדי לראות את התוצא כאן.
Read a whole number with input(), convert it with int(...), then print it doubled (times 2). For input 6, the output should be 12. · קרא מספר שלם עם input(), המר אותו עם int(...), והדפס אותו כפול פי 2. עבור הקלט 6, הפלט צריך להיות 12.
Click Run to see the output here. · לחץ על הרץ כדי לראות את התוצא כאן.