Search This Blog

Wednesday, 16 July 2025

Python Basics : Functions in Python

 Functions are a means to aid modular programming where reusable chunks of code are grouped together, to be created once and invoked several times.

This is the first step to modular programming which then leads to creating modules, classes and packages for re-usability. This practice is common across all languages, and Python is no exception to this rule.

This article covers flavors of creating functions in the traditional way. The same functions can be created in a language agnostic way using lambdas. This will be covered in a later article.

Syntax of a function is as follows

def function_name (arg1, arg2 ,...):

       your code here...






No comments:

Post a Comment