Let’s check out some exercises that will help understand Lambda better.
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.
Write a lambda function which takes z as a parameter and returns z*11
Assign it to variable named: f.
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.