Lesson 9: Making decisions

Outline:

  1. Recap Lesson 8
  2. A bit more about functions
    • Variable scope
    • Returning multiple values
    • Exercise 2
    • Modifying parameters
  3. Making choices
    • Condition expressions in Python
    • Exercise 4
    • The if keyword
    • Two-way decisions: if/else

Explore after class:

  1. Practice with functions that modify their parameters: Exercise 3
  2. Practice with conditional code: Exercises 5+6

Reading assignment (to be completed by the next class):

  • Zelle sections 6.6-6.8 (pp. 193-203)
  • Zelle sections 7.1-7.2 (pp. 209-220)