Python Functions

Types of Functions

Basically, we can divide functions into the following two types:
1. Built-in functions – Functions that are built into Python.
2. User-defined functions – Functions defined by the users themselves.


Python User-defined Functions

What are user-defined functions in Python?

Functions that we define ourselves to do certain specific tasks are referred to as user-defined functions.

Functions that readily come with Python are called built-in functions. If we use functions written by others in the form of a library, it can be termed as library functions.

All the other functions that we write on our own fall under user-defined functions. So, our user-defined function could be a library function to someone else.


Advantages of user-defined functions

1. User-defined functions help to decompose a large program into small segments which make the program easy to understand, maintain, and debug.
2. If repeated code occurs in a program. The function can be used to include those codes and execute when needed by calling that function.
3. Programmers working on a large project can divide the workload by making different functions.


User-defined can be

* Functions without arguments

* Functions with arguments without returning any value

* function with arguments and returning value

* Function returning  multiple values(Very Important)

Visitor Counter