A function is a named, reusable block of code that receives parameters and can return a value with return. It avoids repetition and splits a program into understandable parts. In Python, you define it with def and then call it by name.
Example
def carre(x):
return x * x
carre(4) # 16