Hi everyone. I have a file of records like this:
ID:13
Date: 12.12
Scores: 2
ID:22
Date: 9.12
Scores: 4
ID:13
Date: 18.12
Scores: 4
I want to have the unique IDs as keys and the sum of the socres for that ID as values in the scoreDict dictionary. This is my code so far:
I want to have for example for person with ID 13 a sum of all her goals. How do I do the summation inside that piece of code? Any guide or help is appreciated.
Best regards, Atrisa
ID:13
Date: 12.12
Scores: 2
ID:22
Date: 9.12
Scores: 4
ID:13
Date: 18.12
Scores: 4
I want to have the unique IDs as keys and the sum of the socres for that ID as values in the scoreDict dictionary. This is my code so far:
Code:
if ID is not None:
if ID not in scoreDict:
scoreDict[ID] = set()
scoreDict[ID].add(Scores)
ID = None
Best regards, Atrisa
Comment