120 likes | 277 Views
Python – Making Decisions. Lecture 02. Control Structures. A program that only has one flow is useful but limited. We can use if statements to make these decisions. If - Syntax. if (condition): indented code block. Comparison Operators. Equal to Greater than Less than
E N D
Python – Making Decisions Lecture 02
Control Structures A program that only has one flow is useful but limited. We can use if statements to make these decisions
If - Syntax if (condition): indented code block
Comparison Operators Equal to Greater than Less than Greater than or equal to Less than or equal to Not equal to == > < >= <= !=
Else- Syntax What if you want something to happen when the if condition is false?
Checking for Multiple Conditions We use an elif statement to check multiple conditions.
Logic Operators Check for multiple conditions in the same keyword. There are only three: and, or, not.