3. Functions#

As we start writing longer and more complicated programs, it becomes necessary to organise them by breaking them down into modular chunks. The tool we use for this is a function - a block of code that performs a specific task. In this section we will learn how to write and use functions in Python.

What you’ll learn

  • How to call functions

  • Function definition, arguments and return values

  • Repeating code with functions and loops

  • Combining functions

3.1. This Week#

Before class read the notes and complete the embedded exercises.

During class work through the workshop.

During and after class complete the exercises.