Making Decisions in Code
Programs need to make decisions based on changing conditions. In Python, we use if, elif, and else statements together with comparison operators.
Comparison Operators:
==Equal to!=Not equal to>Greater than<Less than>=Greater than or equal to
python Example
score = 85
if score >= 90:
grade = "A - Excellent!"
elif score >= 80:
grade = "B - Good Job!"
elif score >= 70:
grade = "C - Keep Practicing"
else:
grade = "Needs Improvement"
print("Your Grade:", grade)