The 6 AI Engineering Patterns, come build with Greg live:Β Starts Jan 6th, 2025
Leverage
Glossary

Def

Define functions in Python

Python def is the command you put at the front of the functions you’re defining.

You can call def when creating functions, or class methods. Make sure that your function code is on the next child indent.

There is not a lot of magic to this one!

Fun fact: def stands for β€˜define’ as in, define a function or define a method.

Let’s take a look at a python def code sample.

Link to code

On this page

No Headings