Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 Python – Making Decisions Lecture 02

2 Control Structures A program that only has one flow is useful but limited. We can use if statements to make these decisions

3 If - Syntax if (condition): indented code block

4 Comparison Operators Equal to Greater than Less than Greater than or equal to Less than or equal to Not equal to == > < >= <= !=

5 Else- Syntax What if you want something to happen when the if condition is false?

6 If Else - Example

7 Checking for Multiple Conditions We use an elif statement to check multiple conditions.

8 Elif - Example

9 Logic Operators Check for multiple conditions in the same keyword. There are only three: and, or, not.

10 Precedence

11 You asleep yet?

12 Logic Example


Download ppt "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."

Similar presentations


Ads by Google