Sitemap
Pythontpoints

Pythontpoints

Python Function Introduction

2 min readDec 9, 2023

A function is a block of code to perform a specific task. A function consisting a group of statements to represent a specific task. The main objective of a function is to perform a task. If there are multiple tasks to be performed then we will define multiple functions. For example, to display output we write print(), to get current time we write time(), to get the power value, python has power() function. These functions are built in functions. Similarly the programmer can define his own functions which are known as user defined functions.

Get Pythontpoints’s stories in your inbox

Join Medium for free to get updates from this writer.

Why Functions ?

  1. Python Functions processing data and performing task as per the requirement in software development.
  2. Once we write a function that can be reused as per the requirement. That’s why functions are also called as reusable code. Due to the reusability code redundancy is avoiding which is the main advantage. That means we can avoid writing same code again and again.
  3. Python Functions representing modular programming approach. A task is dividing into sub tasks where each sub tasks called as a module. To represent each module we define separate function. Then the functions are called from main program to perform the complete task. This is known as modular programming and it makes programming easy.
  4. In software development, code maintenance is becoming easy due to functions. For example, when a new feature is adding in an existing application, then the new function definition can integrate into the application. If a point is not required then we can delete the corresponding function.
  5. At the time of application development, if any error arises then the corresponding function can update without affecting other functions. Hence code debugging is becoming easy.

--

--