If I wanted to iterate over a group of dictionaries, deleting all dictionaries where the value of a certain key was zero, how could I do that? I originally tried the code below, but that obviously doesn't work in many cases, as the length of the group decreases as objects are deleted.
data = [{'symbol': 'AA', 'sum': 0}, {'symbol': 'BB', 'sum': 0}, {'symbol': 'CC', 'sum': 10}]
for i in range (0, len(data)):
if data[i]["sum"] == 0:
del data[i]