Types of Functions in Python

Types of Functions in Python 

  1. Built in Function 

  2. User Defined Function 

1. Built in Function

  • The functions which are coming along with Python software automatically,are called built in functions or pre defined functions.

2. User Defined Function

  • The functions which are developed by programmer explicitly according to business requirements ,are called  user defined functions.

Syntax to create user defined functions:

                 def    function_name(parameters) :     

                         """ doc string"""     


                         return value 

Note: While creating functions we can use 2 keywords  

  1. def (mandatory)  

  2. return (optional)

Eg 1: Write a function to print Hello


  • Parameters are inputs to the function. If a function contains parameters,then at the time of calling,compulsory we should provide values otherwise, we will get  error.

Eg: Write a function to take name of the student as input and print wish message by name.

Eg: Write a function to take number as input and print its square value .