Chapter 2: Flow Control
Loop Statements
***Look at picture - The while clause is often called the while loop or just the loop
What is the difference between == and = in Python?
- The == operator (equal to) asks whether two values are the same as each other. - The = operator (assignment) puts the value on the right into the variable on the left - Note that an integer or floating-point value will always be unequal to a string value.
What should I know about the Boolean data-type?
- The Boolean data-type has only two values: True or False, lacks the quotes you place around strings and they start with capital T or F with the rest of the word in lowercase. - It can be stored in variables. If you don't use the proper case or try to use True and False for variable names, Python will give you an error message.
What are the Binary Boolean operators and their importance?
- They are and and or operators. - The and operator evaluates an expression to True if both Boolean values are true; otherwise, it evaluates to False - The or operator evaluates an expression to True if either of the two Boolean values is True. If both are False, it evaluates to False. - The not operator simply values to the opposite Boolean value
What are the 3 rules for blocks of code?
1. Blocks begin when the indentation increases. 2. Blocks can contain other blocks. 3. Blocks end when the introduction decreases to zero or to a containing block's indentation
What do Flow Control statements do?
Flow Control statements can decide which Python instructions to execute under which condition
What does Comparison Operators do?
They compare two values and evaluate down to a single Boolean value. **Look at picture for Comparison Operators