if True:
== !=
elif
x > 10
and or
else:
not False
>= <=
Unit 2 of 5

Making Decisions

Programs that only run straight through are boring. In this unit, your code learns to think — choosing different paths based on conditions, just like you do every day.

5
Lessons
20
Challenges
1
Project
What You'll Learn

Skills Unlocked in This Unit

⚖️

Compare Values

Use ==, !=, <, >, <=, >= to compare anything.

🔀

Branch with if/else

Make your code take different paths depending on conditions.

🪜

Chain with elif

Handle multiple possibilities with elif chains.

🧠

Combine with Logic

Use and, or, not to build complex conditions.

🏗️

Nest Decisions

Put conditionals inside conditionals for sophisticated logic.

🎮

Build Interactive Programs

Create games and tools that respond to user choices.

Try It Now

Boolean Expression Explorer

Click each result to reveal the answer. Can you predict them all correctly? This previews the thinking you'll master in Lessons 2.1 and 2.4.

🧪 Predict the Output

Interactive
Click each "Reveal" to check your prediction. Try to guess before you click!
Lesson Roadmap

Your Path Through Unit 2

Click any lesson to see its challenges. Each one builds on the last.

⚖️

2.1 Booleans & Comparisons

4 challenges

Master comparison operators and understand how every expression evaluates to True or False.

True / False== !=< > <= >=type: bool
Challenges
Comparison Lab — predict 8 expressions
Eligibility Check — age-based conditions
Password Validator — multi-condition check
Alphabetical — string comparison logic
Start Lesson 2.1
🔀

2.2 if / else

4 challenges

Write your first branching code — programs that choose between two paths based on a condition.

if:else:indentationcode blocks
Challenges
Bouncer — age check gate
Even or Odd — modulo logic
Grade Letter — pass/fail converter
Absolute Value — build abs() yourself
Start Lesson 2.2
🪜

2.3 elif Chains

4 challenges

Handle three, four, or more possibilities with elif. Build multi-way decision programs.

eliforder matterscatch-all elsemulti-way branching
Challenges
Letter Grade — A/B/C/D/F converter
Season Finder — month to season
BMI Category — calculate and classify
Rock Paper Scissors — determine winner
Start Lesson 2.3
🧠

2.4 Logical Operators

4 challenges

Combine conditions with and, or, and not to build sophisticated decision logic.

andornotcompound conditions
Challenges
Ride Check — height AND age gates
Leap Year — the classic algorithm
Login System — multi-condition auth
Triangle Validator — geometry logic
Start Lesson 2.4
🏰

2.5 Nested Conditionals

4 challenges

Build decisions within decisions. Learn when to nest, when to chain, and how to decompose complex logic.

nestingrefactoringdecompositiondecision trees
Challenges
Shipping Calculator — weight + destination
Movie Recommender — preference quiz
Tax Bracket — progressive calculation
20 Questions — animal decision tree
Start Lesson 2.5
🏗️

Unit Project Text Adventure

capstone

Build a one-room text adventure game! Describe a scene, offer choices, branch to outcomes, and include at least one nested decision. Everything from Unit 2 in one interactive story.

if / elif / elseand / ornested logicinputf-strings
What You'll Build
Describe a scene with print statements
Offer 3+ choices via input
Branch to different outcomes per choice
Include at least one nested decision
Start Project

Ready to Make Decisions?

Lesson 2.1 takes about 15 minutes. You'll start comparing values and predicting boolean results right away.

Begin Lesson 2.1
Builds on everything from Unit 1