A function is a block of code that only runs when it is called. Python functions return a value using a return statement, if one is specified. A function can be called anywhere after the function has been declared.
By itself, a function does nothing. But, when you need to use a function, you can call it, and the code within the function will be executed.
In Python, there are two types of functions: user-defined and built-in. Built-in functions are functions like:
print(), which prints a statement to the console
Python len(), which calculates the length of a list
Python str(), which converts a value to a string
User-defined functions are reusable blocks of code written by you, the developer. These blocks of code allow you to organize your code more efficiently. This is important because the more organized your code is, the easier it will be to maintain.