Functions

The purpose of a function is to group business logic into a re-usable unit.

A function is defined by starting a line with the def keyword followed by a function name, an opening brace, a closing brace and a colon. The code within the function needs to be indented.

The function itself can be called by stating the function name and the braces.

Example:

def hello_world():
    print("Hello World")


hello_world()

Next: