top of page

Data Scientist Program


Free Online Data Science Training for Complete Beginners.

No prior coding knowledge required!

Simple Lambda Function Expressions in Python

When you utilize lambda as an anonymous function inside another function, the power of lambda is better demonstrated.

Assume you have a function definition that takes one parameter and multiplies that argument by an unknown number:

def myfunc(x):
    return lambda a : a * x  

I have made a function that always doubles the number you send in using that function definition:

def myfunc(n):
    return lambda a : a * n

dbl = myfunc(3)

This is a simple example of the use of lambda function in python. Try to change the arguments and practice by your own.


Recent Posts

See All


bottom of page