(i) def may have multiple expressions. On the other hand, lamda can have single expression only.
(ii) def creates a function and assigns a name so as to call it later. lambda creates a function and returns the function itself
(iii) In case of def, we may have a return statement. But in case of lambda there can't be any return statements.
(iv) lambda can be used inside list, dictionary.
No comments :
Post a Comment