AtomLearnAtomLearn
DashboardGoalsPathAchievementsReviewSign In
Programming FundamentalsNot Started

Conditionals

Make decisions with if/elif/else

0%
Knowledge0%
Learn & Drill
Fluency0%
Drill & Speed
Retention0%
Mastery & Review
Confidence0%
All modes
Practice
Knowledge
Fluency
Retention

Knowledge Debt detected

You can study this freely — but your score may plateau if these foundations have gaps. The Mastery badge requires them to be solid.

Explanation

Conditionals let your program make decisions based on whether an expression is or .

age = 18
if age >= 18:
    print("Adult")
elif age >= 13:
    print("Teenager")
else:
    print("Child")
What will this print?

Already covered the basics? Shaky on and/or? Step back to Logical Operators. Need a refresher on == vs !=? Check Comparison Operators.

Python uses indentation (4 spaces) to define blocks — there are no curly braces.

Examples

Ternary / conditional expression

Python's one-line conditional expression

score = 75
result = "pass" if score >= 60 else "fail"
print(result)  # pass

How well did you understand this?

Next in Programming Fundamentals

Scope & Namespaces

Continue

Unlocks