WHAT ARE LAMBDA FUNCTIONS IN PYTHON?

543 viewsPYTHONPython
0

WHAT ARE LAMBDA FUNCTIONS IN PYTHON?

Saraswat World Changed status to publish June 16, 2023
0

Definition of Python Lambda Functions

Lambda Functions are anonymous or unnamed short functions.

Syntax of Lambda Functions in Python

lambda arguments: expression 

Examples of Python Lambda Functions

Lambda function with single argument

Code

add = lambda num: num + 5  
print( add(2) )

Output

7

Lambda function with multiple arguments

Lambda functions can take any number of arguments

Code

x = lambda a, b : a * b
print(x(5, 5))

output

25
Saraswat World Changed status to publish June 16, 2023
Write your answer.

Posted

in

Tags:

Comments

Leave a Reply

A Tribute to Dilip Kumar