Python Question:
Download Job Interview Questions and Answers PDF
What are uses of lambda?
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
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 Question | Next Question |
Is python the right choice for Web based Programming? | When you need ordered container of things, which will be manipulated, use lists. |