Difference between lamda and def in Python

  • def can contain multiple expressions whereas lamda is a single expression function
  • def creates a function and assigns a name so as to call it later. lambda creates a function and returns the function itself
  • def can have return statement. lambda cannot have return statements
  • lambda can be used inside list, dictionary.