A function is a reusable set of operations.
That sounds like a pretty straightforward definition. But what does it exactly mean?
Take the print() and len() statements for instance. Both always perform predefined tasks. Hence, they are examples of functions!
You can think of functions like a bunch of code that is intended to do a particular task in the whole Python script. Python used the keyword ‘def’ to define a function.