Functions

More functions

Define functions before you use them

Ray
Ray

I tried this, and got the error NameError: name 'rect_area' is not defined.

Functions

Python (and most languages) have a way to wrap code up so it can be called repeatedly: functions.

A function is a piece of code with a name. Other code calls the function when it wants something done.

Let's take the name tag program we wrote at the beginning of the course.