Python Question:

What are uses of lambda?

Tweet Share WhatsApp

Answer:

It used to create small anonymous functions at run time. Like e.g.

def fun1(x):

return x**2

print fun1(2)

it gives you answer 4

the same thing can be done using

sq=lambda x: x**2

print sq(2)

it gives the answer 4

Download Python PDF Read All 25 Python Questions
Previous QuestionNext Question
Is python the right choice for Web based Programming?When you need ordered container of things, which will be manipulated, use lists.