Booleans
Booleans are True or False statements. Unlike strings or numbers, booleans store statements of truth: is what I’m saying true or false?
For example, if I say, “You are a robot”, a boolean can store whether this statement is true. In this case, since you are not a robot (hopefully!), False would be stored.
What are the boolean answers to these questions about you?
- I am a human. _______
- I have 25 fingers. _______
- I like cookies. _______
- My favorite color is blue. ______
Operator | Description | Operator | Description |
---|---|---|---|
< | Less than | > | Greater than |
<= | Less than or equal to | >= | Greater than or equal to |
== | Equal to | != | Not equal to |
As usual, use print to print out your results to the following:
print(5 + 8 < 10) print((3 + 5) * 6) == (65 - 17)
The first statement should return False. And the second should return True.