Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from functools import reduce
- def reducer(x, y):
- if y % 2 == 0:
- return x + y
- return x
- lst = [int(item) for item in input("Enter the list items: ").split()]
- evenSum = reduce(reducer, lst, 0)
- print(evenSum)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement