First page Back Continue Last page Overview Graphics
Functions
A Python function consists of Python code, that can be called repeatedly, with different inputs and outputs each time.
The benefit of functions:
- Code reuse
Functions are an easy way to package logic so you are able to use it in more than one place and more than one time.
- Procedural decomposition
Functions also provide a tool for splitting systems into pieces with well-defined behaviour, which keeps things simpler.