Skip to content Skip to sidebar Skip to footer

Python Sum Values In List Of Tuples Up To Certain Values

NOTE: I edited the question! I am having trouble with iteration in Python, especially when I would like to sum up values up to a certain number. Here's more information on the prob

Solution 1:

Sorry, didn't bother reading your attempt, looks very complicated.

min_sums = []
max_sums = []
for x, _, what in minmax_list:
    if what != 'NA':
        current = min_sums if what == 'min' else max_sums
        current.append(0)
    current[-1] += x

Post a Comment for "Python Sum Values In List Of Tuples Up To Certain Values"