2.5.1.1 Defining and Invoking Functions
Python Programming
Functions are defined using the def keyword, followed by the function name and parentheses which may include parameters. The body of the function contains the code to be executed and must be indented.
python
def function_name (parameters): # code to be executedExample: Define a function to greet a person.
python
def greet(name):
print("As-Salaam-Alaikum", name)
# Function invoking means call the function by name and perform the required task For example.
greet('Ali')