💡 What You'll Learn
Comparisons check relationships between values and return True or False (boolean values). You can combine comparisons with and, or, and not.
== equals!= not equals> greater than< less than>= greater or equal<= less or equal
compare.py
1x = 10
2y = 5
3print(x > y) # True
4print(x == y) # False
5print(x >= 10 and y < 10) # True
📺 Try different values!
Results appear here
🎯 Your Challenges
1Check Equality
Check if X equals Y using ==
2AND Gate
Use and to check if X > 5 AND Y > 5
3NOT Gate
Use not to invert a comparison result
📚 What You Learned
- Comparisons return
TrueorFalse andneeds both true,orneeds one truenotflips the result- Use
==for equality (single = is assignment)