in Python by
Q:
What do you understand by lambda function? Create a lambda function

▼ Show 1 Answer

0 votes
by

To Create a lambda function which will print the sum of all the elements in this list -> [5, 8, 10, 20, 50, 100]

from functools import reduce

sequences = [5, 8, 10, 20, 50, 100]

sum = reduce (lambda x, y: x+y, sequences)

print(sum)

Python
Learn More with Madanswer

Related questions

...