Functions

A function is a set of statements that perform a specific task. Using functions helps in breaking our program into smaller parts. Programs will be more organized if we use functions as it avoids repetition and makes code reusable. Look at the following syntax:

def function_name(parameters):
statement(s)

Refer to the following example:

def welcome(name):
print("Hello " + name + ", Welcome to Python Programming !")

welcome("John")


Output:
Hello John, Welcome to Python Programming !
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset