PYTHON BASICSChapter 2 · Conditionals and logic
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.
Worked example
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.


