4
Functions
Learning Objectives
By the end of this chapter, you will be able to:
- Describe the various function types in Python
- Define global and local variables
- Define a function that takes in a variable number of arguments
This lesson introduces functions in Python. We look at the various types of functions and define our own.
Introduction
In the previous chapter, we covered the following topics:
- How to use looping structures
- How to branch within looping structures
- How to break out of loops
We will continue to build on this knowledge by implementing what we have learned, to build functions in Python.
Functions are an integral part of the Python programming language, and a lot of languages, really. Throughout this book, you have already ...
Get Python Fundamentals now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.