![]() | ![]() |
Functions in Python help split large code into smaller units. Functions make a program more organized and easy to manage.
In Python functions will assume the syntax form below:
def name_of_function (arguments):
“””docstring”””
statements(s)
Example
Start IDLE.
Navigate to the File menu and click New Window.
Type the following:
def welcome(salute):
"""The Python function welcomes you to
the individual passed in as
parameter"""
print("Welcome " + salute + ". Lovely Day!")