Skip to content · ⁨الانتقال إلى المحتوى⁩

Ticket price · ⁨سعر التذكرة⁩

English

Ticket price

age is 30 and member is True. Members pay 5. Everyone else pays 12, or 8 if they are under 18. Store the price in price.

A True/False variable needs no comparison: if member: already asks the question. Writing if member == True: works too, but the short form is what you will see in real code.

العربية

سعر التذكرة

age هو 30 وmember هو True. يدفع الأعضاء 5. يدفع الجميع الآخرون 12، أو 8 إذا كانوا أقل من 18. احفظ السعر في price.

متغير True/False لا يحتاج لمقارنة: if member: يطرح السؤال بالفعل. كتابة if member == True: تعمل أيضاً، لكن الصيغة القصيرة هي ما ستراه في الكود الحقيقي.

Log in or create account · ⁨تسجيل الدخول أو إنشاء حساب⁩

IGCSE, A-Level & AP