Python
a=[1,2,3,4,5]
print(sum(filter(lambda item: item%2==0, a)))
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Python
a=[1,2,3,4,5]
print(sum(filter(lambda item: item%2==0, a)))
a=[1,2,3,4,5]
s=0
for i in range(0,len(a),2):
s+=a[i]
print(s)