Functions - An overview#

Using functions is very important in writing readable code. It lets you write a small block of code, which does some small thing that is useful. Then to do something larger you would call a series of functions to get what you want. It’s like building blocks, you first design the blocks that you need, then connect them together to build something good.

Function characteristics#

  • function’s name,

  • input parameters (\(0\) or more)

  • docstring (documentation of your function, optional but recommended),

  • body of a function (indented block of code).

Functions are not run in the program until we call them in the code which is going to be executed/run