Introduction
This chapter introduces functions. Functions are a fundamental building block for code in all programming languages (though they may go by different names, depending on context).
Learning objectives
- You will learn how to write simple functions in Python, using
def
. - You will learn how to use functions in your code.
- You will learn that indentation is syntactically meaningful in Python (unlike many other languages).
- You will learn how to use functions (and constants) in Python’s
math
module, such as square root and sine. - You will expand on and solidify your understanding of topics presented in earlier chapters.
Terms and keywords introduced
- argument
- call or invoke
def
keyword- dot notation
- formal parameter
- function
- import
- keyword
- local variable
- module
- pure and impure functions
return
keyword- return value
- scope
- shadowing
- side effect
Copyright © 2023–2025 Clayton Cafiero
No generative AI was used in producing this material. This was written the old-fashioned way.