AgerNic.com
WEB DEVELOPER SITE, HTML, CSS, PHP, SQL

Python Anonymous (Lambda) Function


Python Tutorial » Python Anonymous (Lambda) Function

Anonymous function is a function that is defined without a name, normal functions are defined using "def" statement without quotes

Example: Add 26 to argument z, and return the result:
y = lambda z : z + 26
print(y(7))

Output:
33

Lambda functions can take any number of arguments:

Example: Multiply argument x with yb then return the result:
z = lambda x, y: x * y
print(z(15, 5))

Output:
75


Lambda Functions - example


Lambda functions in Python can have any number of arguments, but, only one expression

Example:
def my_func(x):
  return lambda y : y * x

my_la_fun = my_func(7)
print(my_la_fun(26))
Output:
182




python anonymous function, object, variable, class, without argument, multiple lines, list, classes, pipe, functions
Python Anonymous (Lambda) Function - python

Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


0
Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.