Programming with Python

⌘K
  1. Home
  2. Docs
  3. Programming with Python
  4. Variables, Expression and...
  5. Function

Function

  • A function is a block of code which only runs when it is called
  • Function is a sub program which consists of set of instructions used to perform a specific task
  • A large program is divided into basic building blocks called function

Use of Function

  • When the program is too complex and large they are divided into parts. Each part is separately coded and combined into single program. Each subprogram is called as function
  • Debugging, testing and maintenance becomes easy when the program is divided into subprograms
  • Functions are used to avoid rewriting same code again and again in a program
  • Function provides code re-usability
  • The length of the program is reduced

Types of function

Functions can be classified into two types,

  • Built in Function
  • User Defined function

Loading

Views: 0

Articles

How can we help?

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments