Function Definition

To define a function in Python, you use the def keyword, followed by the name of the function, and a set of parentheses (). The code block within the function is indented.

For example:

def call_mum():
    return "Hello Mum!"

To call a function, you use the function name followed by a set of parentheses

call_mum()

Last updated