Defining functions
Defining a function
Steps to define a function:
-
Start with
def
keyword which introduces function definition -
def
keyword must be followed by a function name and the parenthesis containing parameters if the function would be expecting inputs. -
The body of the function starts on the next line and must be indented
-
The first statement of the function body can optionally be a function’s documentation string
docstring
Example
Let’s define a function that prints a message
After we have defined the function above, now it’s time to call it