In Python, lambda expressions are utilized to construct anonymous functions.

To do so, you will use the lambda keyword (just as you use def to define normal functions).

Every anonymous function you define in Python will have 3 essential parts:


  • The lambda keyword.
  • The parameters (or bound variables), and
  • The function body.

Example:

adder = lambda x, y: x + y
print (adder (8, 88))

$python3 main.py
96

Comments

Popular posts from this blog

Check MySQL query history from command line

Installing chocolatey on Windows