A function is a block of code grouped with a name and performs a task. Functions allow for blocks of code to be used many times in a program without having to duplicate code. It also allows large, complex programs to be broken down into small, manageable sub-tasks. Each sub-task is solved by a function, and thus different people can write different functions.
Rules for function names are the same as for variables. Good idea to use meaningful names that describe the function’s purpose. The verb is preferable.
Syntax:Memory locations in parameterList are called formal parameters - each store an item of information passed to the function when it is called.
A function must be called (invoked) to perform its task. The name of the function is used to call the function.
Syntax:You can send any data types of argument to a function (string, number, list, dictionary etc.), and it will be treated as the same data type inside the function.