~ Logic Expressions


Booleans

We've talked about how Python handles numbers already. Let's now turn to how it handles inequalities – things that are either true or false.

The < sign means "less than," and the > sign "greater than" in Python, just like you may have learned in school.

Expressing True

What's true? Anything that's logically true, like:

Expressing False

What's false? Anything that's logically false, like:

Challenge

  1. Use the console below to type four "less than or greater than" math problems. Two should return True and two should return False.

  2. Above, in the sample problems, we used the == symbol. What do you think it means? Try using it in the console below with different numbers on either side, until you think you've got a sense for it. (We'll talk about it next!)