Before you keep reading...
Runestone Academy can only continue if we get support from individuals like you. As a student you are well aware of the high cost of textbooks. Our mission is to provide great books to you for free, but we ask that you consider a $10 donation, more if you can or less if $10 is a burden.
Before you keep reading...
Making great stuff takes time and $$. If you appreciate the book you are reading now and want to keep quality materials free for other students please consider a donation to Runestone Academy. We ask that you consider a $10 donation, but if you can give more thats great, if $10 is too much for your budget we would be happy with whatever you can afford as a show of support.
Chapter 12 - Summary¶
Chapter 12 included the following concepts from computing.
Block of Code - A block of code in Python is one or more code statements that are part of a loop, conditional, function, or procedure.
Boolean Expression - A Boolean expression is one that is either true or false. This is also called a logical expression.
Complex Conditionals - A complex conditional has two or more logical expressions joined by the keywords
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 of the loop.
Decision - A decision is a choice between at least two choices.
Flowchart - A flowchart is a diagram that shows the execution paths for a program. The conditionals are shown as diamonds.
Logical Expression - A logical expression is one that is either true or false, like
x == 3which will return true if x is equal to 3. This is also called a Boolean expression.
Negation - When you 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.
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 the
elsewhen the condition in the
ifpart of the statement is false. An
elsemust always have an
ifstatement before it.
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.
This is the end of chapter 12. We would love it if you could give us some feedback on this chapter at https://www.surveymonkey.com/r/ch12-teacher-fb. You might want to open this link in a new tab to make it easier for you to return to your place in this ebook.