19
Lesson 19 of 20 ยท Logic
Logic โ Part 8
True and false. Combine conditions. This is part 8 of 20.
What you'll learn
You will learn that comparisons produce True or False (booleans), and these power every decision in code.
Steps
- 1Computers think in True and False. a > 3 asks 'is 5 greater than 3?' โ yes, so it's True.
- 2a > 10 asks 'is 5 greater than 10?' โ no, so it's False. These True/False values are called booleans.
- 3Other comparisons: == (equal?), != (not equal?), < (less than?), >= (greater or equal?). They all give True or False.
- 4Booleans power every decision in code. Every 'if' statement checks a boolean. Every game checks: is the player alive? True or False!
Key Terms
- Boolean
- A value that is either True or False.
- Compare
- Checking how two values relate: equal (==), greater (>), less (<).
- Condition
- Something that is true or false. Programs use conditions to make decisions.
Python 3
Output
Loading Python... This may take a few seconds.
Your code runs only in your browser. No code is sent to any server. Stay safe and have fun learning!
๐จ๏ธView in Shop
Checkout complete lesson on Logic for 4th Grade
Get the full Logic track as a printable PDF โ all lessons, worksheets, and answer keys.
