📚 › Python: the friendliest first language
7. Making decisions
ستتم ترجمة هذا المقال تلقائيًا. يُعرض بالإنجليزية حاليًا.
An if statement runs its block only when the condition is True. elif checks another condition and else handles everything else. Indent the block with four spaces: Python uses indentation to know which lines belong together.
Use == for equal and != for not equal.
عرض المثال
marks = 65
if marks >= 80:
print("A")
elif marks >= 50:
print("B")
else:
print("C")
✍️ دورك الآن
Let temperature = 35. Print hot if it is above 30, otherwise mild.