Table of Contents
Functions are reusable pieces of programs. They allow you to give a name to a block of statements and you can execute that block of statements by just using that name, anywhere in your program and any number of times. This is known as calling the function.
Functions are defined using the def keyword. This is followed by an identifier name for the function. This is followed by a pair of parentheses which may enclose some names of variables. The line ends with a colon and this is followed by a new block of statements which forms the body of the function. An example will make this easy to understand.