Python lambda functions
Lambda or lambda function is a single line method or function can take any number of arguments then evaluate and returned. It called anonymous function as well.
Objectives
-
Python lambda with examples
Python lambda with examples
Syntax
lambda arguments : expression
Code
# Lambda example
personal_info = lambda first_name, last_name, email: first_name + " " + last_name + " " + email
print(personal_info("Touhid", "Mia", "hmtmcse.com@gmail.com"))
sum = lambda a, b: a + b
print(sum(5, 10))
Output
Touhid Mia hmtmcse.com@gmail.com
15
Process finished with exit code 0