Python Question:
Download Questions PDF

What are uses of lambda?


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 Interview Questions And Answers PDF

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.