Answers for "what is the advantage of using lambda function in python"

14

what is lambda in python

Lamda is just one line anonymous function
Useful when writing function inside function
it can take multiple arguments but computes only one expression

Syntax:
   x = lambda arguments : expression
Posted by: Guest on July-25-2020
0

An example of using lambda

def myfunc(n):
  return lambda a : a * n

mydoubler = myfunc(2)

#This prints 22
print(mydoubler(11))
Posted by: Guest on October-01-2021

Code answers related to "what is the advantage of using lambda function in python"

Python Answers by Framework

Browse Popular Code Answers by Language