This is an archived version of the course. Please find the latest version of the course on the main webpage.

Chapter 6: Function calls

Functions

face Josiah Wang

In our lessons so far, you have used things like input() and print().

These are actually special programming constructs called functions.

A function is a ready-made building block that you can just reuse and plug into your program.

It takes some input, and produces an output.

You can treat it as a black box. You do not need to know what exactly goes on inside the building block.

Functions as a black box