Question:

Consider variable  x. do the following operation. Add 2 to x and square the result. Again add 3 to x and square the result. Do using anonymous functions in python

Program:

Explanation:

The lambda operator or lambda function is a way to create small anonymous functions, i.e. functions without a name. These functions are throw-away functions, i.e. they are just needed where they have been created. Lambda functions are mainly used in combination with the functions filter(), map() and reduce().

Output:

Leave a Reply