Sep 21: Defining Functions, return
Meet in King 248
Learning Objectives
After today's class, you should be able to:
- Describe the syntax of function definitions and function calls.
- Explain the flow of execution from one function to another.
- Write short functions that have parameters and return values.
Lesson Outline
Mini Lecture [15 min]
- Functions have parenthesis
- Example from algebra: \(f(x) = 2x\)
- \(f\) is a function, \(x\) is a variable, \(2x\) is the result
- Python keywords:
defandreturndef double(number): return 2 * number - Examples
Practice [35 min]
- Ex5.2 Unit Conversions
- Submit to Gradescope before you leave
- Submit even if you haven't fully finished
Your To-Do List
- Read the Week 5 guide and begin studying