CAS CS 111 Lecture Notes - Lecture 5: Boolean Expression
CAS CS 111 verified notes
5/38View all
Document Summary
Flow of control = order in which statements are executed. By default, a program"s statements are executed sequentially, from top to bottom: conditional execution. To solve many types of problems, we need to change the standard flow of control. Conditional execution allows your code to decide whether to do something, based on some condition. Examples of calling this function from the shell: recall: conditional execution in scratch, simple decisions: if statements. Condition is an expression that is true or false. True block is one of more intended statements. Python provides a set of relational operators for making comparisons: boolean expressions. A condition has one of two values: true or false. They are literals from the bool data type. An expression that evaluates to true or false is known as a boolean expression: forming more complex conditions. Python provides logical operators for combining/modifying boolean expressions: a word about blocks. A new block begins whenever we increase the amount of indenting.