Minu's Games logo
MINU'S ROBOTICS

A Minu's Games EdTech Lab

← Code & Cognition
Day 7 of 30Python Foundations

🔀Conditionals (if / elif / else) · Project

🎯 Today's objective

Make programs choose different paths — then build a Smart Quiz.

📖 Key concepts

  • if runs code when a condition is True
  • elif checks more conditions
  • else is the fallback
  • Indentation defines the block

💻 Try this code

score = int(input("Score (0-100)? "))
if score >= 90:
    print("Grade A")
elif score >= 60:
    print("Grade B")
else:
    print("Keep practising!")

👥 Learn it your way

🧒 Young Explorers

Conditionals are choose-your-own-adventure: different answers, different endings.

Your task

Make a mood program: ask 1–10 happiness and reply differently for low/mid/high.

💼 Professionals

Prefer early returns / guard clauses over deeply nested ifs in real code.

Your task

Classify a BMI value into Underweight/Normal/Overweight with clear thresholds.

🤖 AI connection

Before machine learning, "AI" was largely rule-based — giant if/elif trees (expert systems). You’re building that classic foundation today.

★ Week 1 Project — Smart Quiz

Build a 5-question quiz. Ask questions with input(), check answers with if/elif, keep a score, and print a grade + encouraging message at the end. Pro stretch: add a timer or categories.

✅ Quick check

When does elif run?

When the previous if/elif was False and its own condition is True.

What defines a block in Python?

Indentation.