Functions 2 and Indefinite Iteration Preparation
Overview
Functions are very powerful, but also have aspects of them that can be particularly confusing. Today we are focusing on a few of these: how returning really works, thinking more about scope, and how functions can impact mutable objects like lists.
We’re also revisiting iteration to learn about the while
loop.
Basic Learning Objectives:
Before class, you should be able to:
- Write a simple function that returns a value
- Define the meaning of scope and local variable
- Explain how functions can impact mutable objects
- Use a
while
loop for indefinite iteration
Advanced Learning Objectives:
After class, you should be able to:
- Write and use multiple functions that return values to solve a problem
- Use local variables within functions correctly
- Write a function that changes a list without needing to return it
Resources
You should read/watch the following and complete the embedded checks through Moodle:
- Runestone 12.9-12.10
- Runestone 12.12-12.14
- Runestone 14.2-14.3