The Anonymous Functions

Let's learn about anonymous functions and it's syntax.

Introduction

Functions without a name are called anonymous functions because they are not declared by the standard approach of using the def keyword in Python or the function keyword in PowerShell. In Python, we can use the lambda keyword to create small, anonymous functions that can have multiple arguments and an expression evaluated in a single statement based on the arguments passed.

Anonymous function in Python

Syntax of lambda function in Python:

lambda [arg1 [,arg2,.....argn]]: expression

Get hands-on with 1200+ tech skills courses.