+ 1

Can a prime checker be made with in a Lamda Function?

27th May 2020, 9:21 AM
NISANTH S
2 odpowiedzi
+ 8
Lambda simply means anonymous function. They are used in functional programming when you need to use a function once to apply or filter a list of elements. Where defining a named function would be tedious and reduntant. Anything you can do with a regular named function. You can do with a lambda function Lambda python lesson: https://www.sololearn.com/learn/Python/2460/ #Code example lst= [1, 2, 3, 4, 5, 10] #regular named function def square(n): return n*n #mapping a lambda function to square a a list of numbers print(list (map(lambda n: n*n, lst))) #vs print(list(map(square, lst)))
27th May 2020, 12:44 PM
Lord Krishna
Lord Krishna - avatar