Lesson 7 of 34
Comparisons: True or False
6 min 20 XP
When you compare two values, Python answers with True or False. These are called Booleans.
Example: edit me and press Run
Output Loading Python (first time takes a few seconds)
Press Run to see the result here.= stores a value (assign). == asks “are these equal?” (compare). Don't mix them up!
You can compare strings too, but capitals matter: "Chennai" and "chennai" are not equal.
Example: edit me and press Run
Output Loading Python (first time takes a few seconds)
Press Run to see the result here.