Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Named Functions

But Python also lets us to create (and name) our own functions.

We can define or name a function using the def keyword. A function definition includes a few core components:

The core syntax for defining your own function:

# use def keyword to define function name
def function_name(argument):
 statement(s)
 return result

Let’s unpack each of those components.