Up until now, you’ve been teaching Python how to think.
You showed it how to:
Ask questions
Compare values
Make decisions
Choose between paths
Handle more than one possibility
Combine logic with
and,or, andnot
Now it’s time to use all of that in one place.
We’re building a simple interactive program that asks the user a few questions…
and then decides whether they’re a Hero or Villain.
No graphics.
No fancy tricks.
Just clean logic, clear decisions, and a fun result.
What This Project Practices
This mini-project uses:
input()if / elif / elseComparison operators
Boolean logic
String cleanup
Comments
Clear program flow
Everything you’ve learned in Step 2, nothing more.
Step 1: Ask the Questions
We’ll ask the user three simple questions.
# Ask the user a few questions
name = input("What's your name? ")
power = input("Choose a power (strength / invisibility / mind control): ")
choice = input("Do you help others? (yes / no): ")
So far, this is just conversation.
Python is listening.
Step 2: Clean the Input
To avoid surprises, we clean the input before using it.
name = name.strip().title()
power = power.strip().lower()
choice = choice.strip().lower()
This makes comparisons much more reliable.
Step 3: Make the Decision
Now comes the fun part.
We’ll decide based on:
The chosen power
Whether the user helps others
Here’s the logic in plain English:
If you help others → Hero
If you don’t help others → Villain
Some powers sound more suspicious than others
Let’s write that in Python.
# Decide the role
if choice == "yes" and power != "mind control":
role = "Hero"
elif choice == "yes" and power == "mind control":
role = "Hero (but slightly suspicious)"
else:
role = "Villain"
Python checks each condition from top to bottom and picks one path.
Step 4: Reveal the Result
Now we show the result in a dramatic way.
print()
print("Analyzing your answers...")
print()
print(f"{name}, you are classified as a {role}.")
That’s it.
Simple logic.
Clear outcome.
Full Program (Copy–Paste Ready)
Here’s the complete mini-project in one piece:
# Ask the user for information
name = input("What's your name? ")
power = input("Choose a power (strength / invisibility / mind control): ")
choice = input("Do you help others? (yes / no): ")
# Clean the input
name = name.strip().title()
power = power.strip().lower()
choice = choice.strip().lower()
# Decide the role based on the answers
if choice == "yes" and power != "mind control":
role = "Hero"
elif choice == "yes" and power == "mind control":
role = "Hero (but slightly suspicious)"
else:
role = "Villain"
# Print the result
print()
print("Analyzing your answers...")
print()
print(f"{name}, you are classified as a {role}.")
This program:
Asks questions
Makes decisions
Combines logic
Produces different outcomes
Feels interactive and alive
That’s a big win.
Mini Quiz
Why do we use
.lower()before comparisons?Which condition runs first — the
ifor theelif?Will Python ever assign more than one role? Why or why not?
What happens if the user types something unexpected?
Which part of the program actually makes the decision?
Extra Challenges (Optional)
If the learner wants more practice:
Challenge A
Add a third role, like Anti-Hero, based on a new rule.
Challenge B
Ask one more question and include it in the logic.
Challenge C
Change the powers and outcomes to something funny.
Challenge D
Rewrite the decision rules in plain English before coding them.
Step 2 Complete!
You’ve officially taught Python how to:
Think
Decide
React
Choose
This is the foundation of real programming.