Function in Python

 Python Notes Unit -3 , Part-1

UNIT-3 (Part-1)

Organizing Python codes using functions.

Organizing Python projects into modules.

Importing own module as well as external modules.

Understanding Packages.

Definition of Functions

    1.   In python programming language function is an important part of code.

    2.   We can pass data, which is known as parameters, into a function.

    3.    Function can return data as a result.

    4.   We use functions in any programming language to group a set of instructions, that we can use one or more times in code.

    5.   Functions help break our program into smaller and modular part.

    6.   With the help of functions our program is organized and manageable. It manages the input and outputs in computer programs.


Types of function –

There are mainly four types of functions in python programming –

a.    Python Built-in Functions

b.   Python Recursion Functions

c.    Python Lambda Functions

d.   Python User-defined Functions

Syntax of functions- 

                                    def  function_name( parameters ):


                                              function _suite


Example –

 # Python program to add two numbers using function.

         def add_num(a,b):


                  return sum;



    print(“The sum is”,add_num(num1,num2))


Output –

The sum is 77.


Keep learning and keep exploring

Please do comment for more updates

Also subscribe my you tube channel

Engineers Success Tutorial

UNIT -01 Notes

Introduction, Variables and Data types Part-1 

Introduction, Variables and Data Types Part 2

Introduction, Variable and Data Type Part 3

UNIT -02 Notes

Conditional statements in python part 1          

 Conditional statements in python part 2      



Latest Update

Function in Python

Popular Posts