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.
الـ OUTPUT يصبح print()
- في الامتحان، يُظهر OUTPUT شيئًا على الشاشة.
- في 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(). - يعيد دائمًا سلسلة نصية (string)، حتى لو كتب المستخدم أرقامًا.
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.
في الامتحان: الخوارزميات الوهمية (pseudocode)
- نفس المفهوم في خوارزميات Cambridge pseudocode يستخدم
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()يعيد نصًا (a string)؛ استخدم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. · اضغط تشغيل لرؤية المخرجات هنا.