Week 5: More Functions

Week 5 Goals

  • Define functions

  • Pass data into functions via parameters

  • Get results out from functions via return values

  • Draw stack diagrams to model function behavior

Week 5 Code

  • echo.py: While loop practice (time permitting)

  • function_examples.py: Examples of functions that take parameters

  • stack1.py: A program to trace for drawing a stack diagram

  • totally.py: Practice program for writing a function that produces a return value

  • slicing.py: Practice with string slicing