Functions
Functions are a nice way to organize your code and make it reusable. We’ve already been using functions a lot in this class: print()
is a function that’s built into Python, and forward()
and right()
are functions that are built into the Turtle library. This week you’ll start writing your own functions.
Readings
- Think Python: Functions
- Automate the Boring Stuff: Functions – stop reading at “Local and Global Scope”
- Learn Python: Functions – practice
Summary
For the summary this week, think about what you’ve learned about functions, and whether anything else you’ve encountered outside of the class is similar.
Summary prompt: How would you describe what a function does, and what it’s for? How is a function different from a variable?
Question
As per usual, your question can be one of three types:
- Confusion: what didn’t you understand in the readings?
- Curiousity: what do you want to know more about?
- Connection: how does this topic connect to your own experiences?
Submit your summary+question on D2L under Quizzes before class starts on Tuesday.