Back Navigation Next Navigation Video 8: Functions (page 3 of 9)

The syntax for defining a custom function is as follows:

1) def marks the start of function header or signature.

2) After the def keyword, we specify the function name. A function name is how we uniquely identify our function. Function naming follows the same rules for variable names in Python.

3) Next (after the name), we will have parentheses (). We can have no text in the parentheses if the function does not contain any parameters or we can have several parameters separated by commas in these parentheses. Parameters are used to store values that get passed to a function. They are optional (i.e., not all functions are required to have parameters in the ()s).