I am getting an error message when trying to add the values for each player from a dictionary, it could be because the values in my dictionary is a string but I am not sure. The code is:
with open("players.dat") as f:
    group = []
    for line in f:
        fields = line.split()
        group.append( (fields[0], int(fields[1])) )
    print(group)
from collections import deque
player_stats = {}
with open("players.dat") as f:
    for line in f:
        name, score = line.split()
        player_stats.setdefault(name, deque(maxlen=3))
        player_stats[name].append(score)
        sum(player_stats.values())
print(player_stats)
The data file is:
rooney 12
rooney 23
rooney 56
rooney 27
ronaldo 14
ronaldo 34
messi 23
messi 45
messi 12
messi 56
 
     
    