Member-only story

Basics of Python Function with Examples

A handful concept of functions idea in python methods

Amit Chauhan
6 min readOct 30, 2022
Photo by Fotis Fotopoulos on Unsplash

Introduction

When working with programming languages, we frequently find ourselves trapped with big programs that are hard to maintain. That large program is broken down into smaller units to reduce the complexity and size of the program is known as functions. It is a group of program statements in a unit. This unit can be mentioned from other parts of the program as well.

With an appropriate name given to the function, the program/code becomes readable and understandable to the programmer. To acquire the results, we send the values or input within function parenthesis into the same code rather than repeatedly creating the same code for many applications.

What is a function?

A function is a component of the program that is called simultaneously at various times by the program to execute a specific task.

We use some common functions without knowing it:

Example: print(),math.sqrt(num),math.pow(base,exp),str.lower(),str.isupper(),list1.append(),etc.

Here in all the functions, there are a set of codes formulating it, hence telling the function what task it has to perform. Moreover, the functions above are inbuilt…

--

--

Amit Chauhan
Amit Chauhan

Written by Amit Chauhan

Data Scientist, AI/ML/DL, Azure Cloud

No responses yet