Elance Exams Answers PDF file

-- PDF FILE --
Download PDF file of elance Zoho Creator Exam Answers

A function can be declared using "def double(x): return x+x" or using "double = lambda x: x+x". What is the difference between these declarations?

The first (def) defines "double" in the global or class namespace, while the second (lambda) only sets a local variable.
The first (def) has its "__name__" attribute initialized to "double", but the second (lambda) does not.
No difference: the declarations have the same effect.
CPython can optimize and execute the first (def) more efficiently than the second (lambda).
The second (lambda) can be used as a function argument, as in "map(double, l)", but the first (def) cannot.
  • Follows us our servcies
  • Facebook icon
  • Linkedin icon
  • twitter icon
  • rss icon
  • social icon