Chapter 13 - Summary¶
Chapter 13 included the following concepts from computing.
- Boolean Expression - A Boolean expression is one that is either true or false. This is also called a logical expression.
- Condition - A condition is something that is either true or false. This is also called a Boolean expression or a logical expression.
- Conditional Execution - Conditional execution means that one or more statements are executed only when a condition (logical expression) is true. This is also called a conditional. The statements that are executed when the condition is true are called the body.
- Decision - A decision is a choice between at least two choices.
- Input - The
inputfunction returns a value that the user enters. - Logical Expression - A logical expression is one that is either true or
false, like
x == 3. This is also called a Boolean expression.
Summary of Python Keywords and Functions¶
- And - The keyword
andis used to join two logical expressions and then both of the logical expressions must be true for the joined expression to be true. - Else - The keyword
elseis used to execute one or more statements in a block following theelsewhen the condition in theifpart of the statement is false. Anelsemust always have anifstatement before it. - Elif - The keyword
elifis used when you want to have a conditional with 3 or more possibile options. Add as manyelifstatements as you need after anifand before aelse. - If - The Python keyword
ifis used to start a condition. It is followed by a Boolean expression and then has one or more statements in the body of the loop that are executed only if the Boolean expression is true. - Not - The keyword
notis used to negate a logical expression. If the original expression is true the negated expression is false and if the original expression is false the negated expression is true. - Str - The function
strturns a number into a string so that it can be appended to a string.