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.


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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.