Lambda - Anonymous Functions
In Python, anonymous function is a function that is defined without a name. While normal functions are defined using the def keyword, in Python anonymous functions are defined using the lambda keyword.
Hence, anonymous functions are also called lambda functions.
- Lambda forms can take any number of arguments but return just one value in the form of an expression. They cannot contain commands or multiple expressions.
- An anonymous function cannot be a direct call to print because lambda requires an expression
Syntax:
lambda arguments: expression
program on lambda
a=int(input("Enter first no"))
b=int(input("Enter second no"))
c=lambda x,y:x*y
print(c(a,b))
For
Online Classes
Contact Us: 9885348743
Online Classes
Contact Us: 9885348743