Skip to content
dreamcode
dreamcode
Back to map
Comparisons · Lesson 3 of 44
+15 XP on finish
PYTHON BASICS

Comparing values

A comparison evaluates two values and returns a boolean value: either True or False. Use == to check if values are equal, != for not equal, and <, >, <=, >= for numeric ordering.

How it reads
clouds < 5 checks if clouds is less than 5, giving True
clouds == 10 checks for equality, giving False
clouds != 0 checks if clouds is not equal to 0, giving True
Cloud tip: In Python, double equals == is used to compare two things, while a single equals = is used to store a value in a variable.
main.py
PYTHON
real Python, runs in your browser
CONSOLE
- run your code to see output -