Booleans and Conditionals
Notes on 3.5, 3.6, 3.7
Booleans and conditionals notes
Boolean expressions
- What is a boolean?
- Data type with only true or false
- Boolean is related to binary
- They both use 1 and 0
Relational Operators
- For example, comparing the values of print statements
Logical Operators
- AND : returns TRUE if the operands around it are TRUE
- OR : returns TRUE if at least one operand is TRUE
- NOT : returns TRUE if the following boolean is FALSE
Conditionals
- If and else are conditionals
-
For example:
x = 20 y = 10 if x > y: print(“x is greater than y”) else: print(“x is not greater than y”)
-