📋 المحتوى المنظم
📖 محتوى تعليمي مفصّل
جرب بنفسك
نوع: محتوى تعليمي
جرب بنفسك
نوع: QUESTION_ACTIVITY
جرب المقطع البرمجي التالي واكتب القيم التي تظهر على الشاشة.
مثال: درجات تقييم الطلبة
نوع: محتوى تعليمي
مثال: درجات تقييم الطلبة
نوع: محتوى تعليمي
لقد عملت سابقًا على مثال لحساب درجات تقييم الطلبة، حيث يتحقق المقطع البرمجي من اجتياز الطالب للامتحانات. ستتعلم كيف يمكنك تطبيق حلقة for. لقد تحققت في المثال السابق من درجات طالب واحد فقط، لنفترض أن عليك التحقق من درجات صف كامل مكون من 15 طالبًا.
نوع: محتوى تعليمي
لا تنس ترك مسافة.
نوع: محتوى تعليمي
لقراءة اسم كل طالب.
نوع: محتوى تعليمي
تُستخدم حلقة for عند معرفة عدد التكرارات المراد قبل بداية التكرار. ماذا يحدث عندما يكون الرقم غير معروف والتكرار يعتمد على شرط معين؟ في مثل هذه الحالات، تُقدم بايثون حلقة while الشرطية.
نوع: METADATA
2025 - 1447
نوع: METADATA
146
🔍 عناصر مرئية
A stylized illustration of hands typing on a laptop keyboard. A pink speech bubble with rounded corners containing the text 'جرب بنفسك' (Try it yourself) points towards the laptop screen.
A grey rectangular box containing the Python code: `for i in range(4,0,-1): print (i)`. An arrow points from this code block to an adjacent empty white rectangular box, which is intended for writing the output of the code.
A grey rectangular box containing the Python code: `for i in range(0,10,2): print (i)`. An arrow points from this code block to an adjacent empty white rectangular box, which is intended for writing the output of the code.
A large grey rectangular box containing a Python program. The program uses a 'for' loop to iterate 15 times (for 15 students). Inside the loop, it prompts the user to enter a student's name and grade. It then uses nested 'if-elif-else' statements to evaluate the grade: if the grade 'g' is greater than 50, the student 'اجتاز الامتحانات.' (passed the exams). Further, if g <= 70, they 'حصل على C.' (got a C); if g <= 90, they 'حصل على B.' (got a B); otherwise, they 'حصل على A.' (got an A). If g is not greater than 50, the student 'لم يجتز الامتحانات.' (did not pass the exams).
A pink rectangular box with rounded corners containing the Arabic text 'لا تنس ترك مسافة.' (Don't forget to leave a space.). This is a programming tip, likely referring to the importance of indentation in Python.
A light blue rectangular box with rounded corners containing the Arabic text 'لقراءة اسم كل طالب.' (To read each student's name.). An arrow points from this box to the 'name=input()' line within the main Python code block (Visual 3).
The logo of the Ministry of Education, Saudi Arabia, featuring stylized Arabic calligraphy and a dotted pattern.
📄 النص الكامل للصفحة
--- SECTION: جرب بنفسك ---
جرب بنفسك
جرب المقطع البرمجي التالي واكتب القيم التي تظهر على الشاشة.
--- SECTION: مثال: درجات تقييم الطلبة ---
مثال: درجات تقييم الطلبة
لقد عملت سابقًا على مثال لحساب درجات تقييم الطلبة، حيث يتحقق المقطع البرمجي من اجتياز الطالب للامتحانات. ستتعلم كيف يمكنك تطبيق حلقة for. لقد تحققت في المثال السابق من درجات طالب واحد فقط، لنفترض أن عليك التحقق من درجات صف كامل مكون من 15 طالبًا.
لا تنس ترك مسافة.
لقراءة اسم كل طالب.
تُستخدم حلقة for عند معرفة عدد التكرارات المراد قبل بداية التكرار. ماذا يحدث عندما يكون الرقم غير معروف والتكرار يعتمد على شرط معين؟ في مثل هذه الحالات، تُقدم بايثون حلقة while الشرطية.
2025 - 1447
146
--- VISUAL CONTEXT ---
**IMAGE**: Untitled
Description: A stylized illustration of hands typing on a laptop keyboard. A pink speech bubble with rounded corners containing the text 'جرب بنفسك' (Try it yourself) points towards the laptop screen.
Context: An introductory visual for a hands-on programming activity.
**CODE_SNIPPET**: Untitled
Description: A grey rectangular box containing the Python code: `for i in range(4,0,-1): print (i)`. An arrow points from this code block to an adjacent empty white rectangular box, which is intended for writing the output of the code.
Context: This code snippet demonstrates a 'for' loop with a decreasing range, starting from 4 down to (but not including) 0, with a step of -1. The expected output would be 4, 3, 2, 1, each on a new line.
**CODE_SNIPPET**: Untitled
Description: A grey rectangular box containing the Python code: `for i in range(0,10,2): print (i)`. An arrow points from this code block to an adjacent empty white rectangular box, which is intended for writing the output of the code.
Context: This code snippet demonstrates a 'for' loop with a step value, starting from 0 up to (but not including) 10, with a step of 2. The expected output would be 0, 2, 4, 6, 8, each on a new line.
**CODE_BLOCK**: Untitled
Description: A large grey rectangular box containing a Python program. The program uses a 'for' loop to iterate 15 times (for 15 students). Inside the loop, it prompts the user to enter a student's name and grade. It then uses nested 'if-elif-else' statements to evaluate the grade: if the grade 'g' is greater than 50, the student 'اجتاز الامتحانات.' (passed the exams). Further, if g <= 70, they 'حصل على C.' (got a C); if g <= 90, they 'حصل على B.' (got a B); otherwise, they 'حصل على A.' (got an A). If g is not greater than 50, the student 'لم يجتز الامتحانات.' (did not pass the exams).
Context: This is an example program demonstrating the use of a 'for' loop to process multiple inputs (student grades) and conditional logic ('if-elif-else') to assign grades and determine pass/fail status. It illustrates practical application of programming concepts.
**HIGHLIGHT_BOX**: Untitled
Description: A pink rectangular box with rounded corners containing the Arabic text 'لا تنس ترك مسافة.' (Don't forget to leave a space.). This is a programming tip, likely referring to the importance of indentation in Python.
Context: Highlights a critical syntax rule in Python programming related to code blocks and indentation.
**HIGHLIGHT_BOX**: Untitled
Description: A light blue rectangular box with rounded corners containing the Arabic text 'لقراءة اسم كل طالب.' (To read each student's name.). An arrow points from this box to the 'name=input()' line within the main Python code block (Visual 3).
Context: Provides a specific explanation for a line of code in the main example, clarifying its purpose.
**IMAGE**: Untitled
Description: The logo of the Ministry of Education, Saudi Arabia, featuring stylized Arabic calligraphy and a dotted pattern.
Context: Branding and metadata for the textbook.
🎴 بطاقات تعليمية للمراجعة
عدد البطاقات: 5 بطاقة لهذه الصفحة
ما هو ناتج تنفيذ المقطع البرمجي التالي في لغة بايثون؟
`for i in range(0,10,2): print (i)`
- أ) 0 1 2 3 4 5 6 7 8 9
- ب) 2 4 6 8 10
- ج) 0 2 4 6 8
- د) 1 3 5 7 9
الإجابة الصحيحة: c
الإجابة: 0 2 4 6 8
الشرح: 1. الدالة range(0,10,2) تبدأ من 0 وتنتهي قبل 10 بخطوة 2.
2. القيم التي ستتكرر عليها الحلقة هي: 0، 2، 4، 6، 8.
3. دالة print() ستطبع كل قيمة على سطر جديد، لكن عند كتابتها كسلسلة متتالية تكون: 0 2 4 6 8.
تلميح: تأكد من فهمك لمعنى البداية والنهاية والخطوة في الدالة range.
التصنيف: سؤال اختبار | المستوى: سهل
ما هو ناتج تنفيذ المقطع البرمجي التالي في لغة بايثون؟
`for i in range(4,0,-1): print (i)`
- أ) 1 2 3 4
- ب) 4 3 2 1
- ج) 4 3 2 1 0
- د) 0 1 2 3 4
الإجابة الصحيحة: b
الإجابة: 4 3 2 1
الشرح: 1. الدالة range(4,0,-1) تبدأ من 4 وتنتهي قبل 0 بخطوة -1.
2. القيم التي ستتكرر عليها الحلقة هي: 4، 3، 2، 1.
3. دالة print() ستطبع كل قيمة على سطر جديد، لكن عند كتابتها كسلسلة متتالية تكون: 4 3 2 1.
تلميح: تذكر أن الدالة range(بداية، نهاية، خطوة) تتوقف عند قيمة قبل النهاية.
التصنيف: سؤال اختبار | المستوى: سهل
متى نستخدم حلقة `for` في البرمجة؟
- أ) عندما يكون التكرار يعتمد على شرط معين فقط.
- ب) عندما يكون الرقم غير معروف والتكرار يعتمد على شرط معين.
- ج) عند معرفة عدد التكرارات المراد قبل بداية التكرار.
- د) لتنفيذ أمر واحد فقط دون تكرار.
الإجابة الصحيحة: c
الإجابة: عند معرفة عدد التكرارات المراد قبل بداية التكرار.
الشرح: 1. حلقة `for` مناسبة عندما يكون عدد مرات تكرار العملية معروفاً مسبقاً.
2. مثال: تكرار العملية لعدد محدد من العناصر في قائمة، أو لعدد محدد من الطلاب (مثل 15 طالباً).
تلميح: فكر في الفرق بين الحلقة التي تعتمد على عدد محدد والحلقة التي تعتمد على شرط.
التصنيف: مفهوم جوهري | المستوى: متوسط
ما هي الحلقة المناسبة في بايثون عندما يكون عدد التكرارات غير معروف ويعتمد على تحقيق شرط معين؟
- أ) حلقة for
- ب) حلقة if الشرطية
- ج) حلقة while الشرطية
- د) حلقة repeat
الإجابة الصحيحة: c
الإجابة: حلقة while الشرطية.
الشرح: 1. حلقة `while` تستمر في التنفيذ طالما أن الشرط المحدد لها صحيح (True).
2. عدد مرات التكرار غير معروف مسبقاً ويعتمد على تغير حالة الشرط أثناء التنفيذ.
تلميح: هناك نوعان رئيسيان من الحلقات في بايثون: for و while.
التصنيف: تعريف | المستوى: متوسط
في مثال تقييم درجات الطلبة باستخدام حلقة `for`، إذا كانت الدرجة المخزنة في المتغير `g` تساوي 85، فما التقييم الذي سيطبقه البرنامج؟
- أ) لم يجتز الامتحانات.
- ب) حصل على C.
- ج) حصل على B.
- د) حصل على A.
الإجابة الصحيحة: c
الإجابة: حصل على B.
الشرح: 1. الشرط الأول: if g > 50 (85 > 50) صحيح، إذن الطالب اجتاز.
2. الشرط التالي: elif g <= 70 (85 <= 70) خطأ.
3. الشرط التالي: elif g <= 90 (85 <= 90) صحيح.
4. لذلك، سيطبع البرنامج 'حصل على B.'
تلميح: راجع تسلسل الشروط في المثال: if g > 50، ثم if g <= 70، ثم if g <= 90.
التصنيف: سؤال اختبار | المستوى: متوسط