CurriculumPython if, elif and else for KidsAsking questions about numbers

Python Comparison Operators: >, <, ==, and True/False

True or False — how the dragon tests a value before deciding anything.

Lesson 1 of 5PROAges 10+
See what PRO unlocks →

Asking questions about numbers

Before the dragon can DECIDE anything, it needs to ASK a question. That's what comparisons do.

Comparing two things gives you an answer of True or False. Nothing else — just those two words.

print(80 > 50)

Output

True

Flip the numbers and you might flip the answer.

print(30 > 50)

Output

False

Careful with 'at least' or 'at most' — the boundary matters. > leaves the exact number OUT.

strength = 50
print(strength > 50)

Output

False

>= means 'greater than OR equal to'. That includes the boundary.

strength = 50
print(strength >= 50)

Output

True

And checking if two things are EQUAL uses two equals signs, not one — one = is for filling a box.

gold = 100
print(gold == 100)

Output

True

Check your understanding

health is exactly 20. What does print(health > 20) say?

health = 20
print(health > 20)
  • False
  • True
  • 20

Why: 20 is not bigger than 20, so print(health > 20) says False. > is strict — the boundary itself does not count. That's what >= is for.

gold = 5. What does print(gold = 5) do — with ONE equals sign, inside print?

gold = 5
print(gold = 5)
  • That's actually an error — = isn't a question
  • True
  • 5

Why: A single = always means assignment, never a question — Python won't let you use it to compare. That's exactly why == exists: two equals signs specifically for asking 'are these the same?'

What you'll practice

The dragon's strength is 80. Ask Python: is that MORE than 50? print() the answer — Python already knows how to say True or False.

Unlock this lesson with PRO →

More from this topic

Asking questions about numbers is one lesson inside Python if, elif and else for Kids — see the full lesson order and what the whole topic covers.

View the full topic →