Functions in python
In this lecture, we will discuss functions in Python. A function is a block of code designed to perform a specific task. Functions help break down complex problems into smaller, manageable parts, making our programs easier to understand and reuse.
Get Rakesh Sharma’s stories in your inbox
Join Medium for free to get updates from this writer.
There are two types of functions in Python:
1. User-defined functions
2. Built-in (system-defined) functions
- User-defined Functions: These are functions created by the developer to fulfill specific needs within the program. Developers can define these functions according to their requirements and can use them multiple times within the program.
- Built-in (System-defined) Functions: These are predefined functions provided by Python, such as
print(),len(),range(), etc. They are part of Python’s standard library and can be used directly without needing to be defined by the user.
How to define a function:








