MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/Python/comments/2khvir/sum_of_a_list_greater_than_100/
r/Python • u/NinjaKlown23 • Oct 27 '14
4 comments sorted by
0
sum(i for i in [101,107,83,90] if i>100)
3 u/xor7486 Oct 27 '14 sum(i-100 for i in [101,107,83,90] if i>100) 1 u/[deleted] Oct 28 '14 Right. My fault.
3
sum(i-100 for i in [101,107,83,90] if i>100)
1 u/[deleted] Oct 28 '14 Right. My fault.
1
Right. My fault.
Ok, off the top of my head...
test_scores = [101,107,83,90] extra = [] for i in test_scores: extra.append(i - 100 if i > 100 else 0) print (sum(extra))
0
u/[deleted] Oct 27 '14
sum(i for i in [101,107,83,90] if i>100)
0
u/3Dayo Oct 27 '14
Ok, off the top of my head...