+1 vote
in Python by
What do you understand by lambda function? Create a lambda function

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)

Related questions

+1 vote
asked Feb 14, 2021 in Python by SakshiSharma
+1 vote
asked Feb 13, 2021 in Python by SakshiSharma
...