Python Lambda Exercises

Let’s check out some exercises that will help understand Lambda better.

Exercise 11-a

Write a lambda function that takes x as parameter and returns x+2. Then assign it to a variable named L.


Supplementary Material: If you are still struggling in understanding lambda or making use of it in a practical sense, check out our Python Lambda Lesson. In that lesson we elaborate on different nuances of lambda through 10+ high quality lambda examples in Python!

Seeing as many examples as possible and practicing is the best way to become instinctively good at Python (or any programming language) concepts and to effortlessly be able to use them in real world applications.

You can start your function as following: lambda x: 
And then write your statement after the colon (:)

L = lambda x: x+2

Exercise 11-b

Write a lambda function which takes z as a parameter and returns z*11


Assign it to variable named: f.


You can start your function as following: lambda z: 
And then write your statement after the colon (:)

f = lambda z: z*11

Exercise 11-c

Write a function which takes two arguments: a and b and returns the multiplication of them: a*b. Assign it to a variable named: f.


You can start your function as following: lambda a, b: 
And then write your statement after the colon (:)

f = lambda a, b: a*b

Need More Exercises?

Check out Holy Python AI+ for amazing Python learning tools.

*Includes 14 more programming languages, inspirational tools and 1-on-1 consulting options.
Umut Sagir
Finance & Data Science Professional,
Founder of HolyPython