Glossary · Python
What is Function?
A named, reusable block of code that takes inputs (parameters) and can return a result.
In more detail
Small functions with clear names make programs easier to read, test and change.
Example
def percentage(obtained, total): return obtained / total * 100
Learn it properlyPython Functions: def, Parameters, Return Values and Scope11 min lesson · Python