Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from functools import reduce
- def accumulator(acc, element):
- return acc + element
- my_list = [1, 2, 3, 4]
- print(reduce(accumulator, my_list, 0)) # 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement