A function is a self-contained block of statements that perform a specific task. A function can be call many times.By using function we can divide a code into the function.Function provides modularity and code reusability.
There are two types of functions-
» Library Functions or Built-in Functions
» User-defined functions
They Are Pre Defined header files.Python used many predefined functions.
These functions are declared by the user depends on their requirements.It reduces complexity of a big program.
Keyword def is used to start and declare a function.
def add(a,b): s=a+b print "Sum of two numbers is :" print s add(20,30) #Calling the sum Function
Sum of two numbers is :50