Collection of code which performs a specific task. Definition Function starts with ‘def’.
Function is very commonly used coding technique in Python. In real time scenarios, the python application (or) python data pipeline is developed using one or more python Functions.
def name_age(name, age):
===>print("You are " + name + " at age " + age)
You are John at age 30
Define Function with Return:
When there is a need to get a value back from Function, the ‘return’ statement helps to get that value from the Function.
‘return’ is the last statement to be used in the ‘Function’ because the control exits out of Function after return statement.
result = cube(5)