Conditional statements allow decisions to be made during program execution: will some group of statements be executed or will they be skipped? Conditional statements are also called branching statements because program execution can "branch off" on different paths. The keywords you will learn are if , else , and elif .

Lecture Prep

Watch:
  1. Program Flow (3 minutes) ( Alternative link )
  2. If Statements (4 minutes) An if statement is a decision point in a program; it determines what will execute next. ( Alternative link )
  3. If-Else Statements (3 minutes) This is a decision point where a program chooses one option out of two possibilities. ( Alternative link )
  4. If-Elif Statements (5 minutes) This is a decision point where there are multiple options. ( Alternative link )
  5. Conditionals and Call Frames (5 minutes) ( Alternative link )
  6. Conditionals and Test Cases (3 minutes) ( Alternative link )
  7. Tracing Conditionals (5 minutes) Conditionals can complicate debugging. This video references the file traces.py . ( Alternative link )

Or Read: 5.1 - 5.7 And Watch the last three lesson videos in the list above.


Lecture materials

Slides: individual slides for viewing , 6-up layout for printing

Questions and Answers: check the answers after you try them on your own!

Link to Lecture Recording