Summing a 2D list

John Salerno johnjsal at
Thu Jun 12 10:28:11 EDT 2008

"Mark" <markjturner at> wrote in message 
news:c0461b8e-a60d-43f3-b0ab-6d2030dcd149 at
On Jun 12, 3:02 pm, "Diez B. Roggisch" <de... at> wrote:
> Mark wrote:

This was my (failed) attempt:

predictions = Prediction.objects.all()
scores = []
for prediction in predictions:
i = [, 0]
if prediction.predictionscore:
i[1] += int(prediction.predictionscore)

Your question sounds like a fun little project, but can you post what the 
actual list of users/scores looks like? Is it a list of tuples like this:

[(1, 0), (1, 1) ... ]

Or something else?

More information about the Python-list mailing list