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