What are Functions ?
• A function is a piece of code which performs a speci c task
• It is used to reduce the repetition of the code hence reducing the size of the
code, Less chances of making mistakes in the code
• Functions make the task easy for the programmers as each programmer in a
team can be given a speci c task( function ) and at the end we can combine
these task together to make single application.
• Some points to remember are :
- Program is a general term
- A very big program is called application
- An application broke into pieces are called modules that performs a speci c
task
- Modules broken into pieces are called Functions / Procedure
Advantages :
- Easy development
- Error free
- Can be developed by a team of programmers
- Reuse modules for function in other projects
Creating a Function :
Syntax : def Name ( <parameter List >)
……….
……….
……….
return result
• A function must return a result and it python it returns result
• If you don’t write return inside a function then it’ll automatically returns None
fi
fi
fi