A user-defined function allows you to package and name several lines of code and reuse those lines of code throughout your program. All you must do is call the name you’ve given your function.
What Is a Function?
A function in Python can be used to perform a simple task, and as such is just a mnemonic or special name given to a collection of lines. You can also optionally send values into a function as parameters or return a value from a function. Only one value can be returned from a function, but that value can be a tuple.