1 / 12

Python – Making Decisions

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

josef
Download Presentation

Python – Making Decisions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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

More Related