Lambda functions in python

Posted on Feb. 13, 2019
python
lambda
1039

This article helps to give you a brief introduction of lambda functions, how to write a lambda function and gives you the code for traditional way of writing functions and lambda functions.

Name Origin: In any programming language a function is called as anonymous function if the specific function definition that is not bound to an identifier. Unlike normal functions which is defined by the key word def, the anonymous functions are declared with the help of lambda keyword.

lambda arguments: expression

we will look at examples with and without using lambda functions.

def square(num):
    return num*num

 

square = lambda num: num*num

 

The way of calling both the functions is same, by square(x) x is any number

How to use map, filter and reduce using lambda functions ?




0 comments

Please log in to leave a comment.