I am trying to write a software which sums up points from a third party text file. This is how the text file looks like:

```
essi 5
pietari 9
essi 2
pietari 10
pietari 7
aps 25
essi 1

```

The main function is supposed to return a sum of each players score into a list, and players are to be in alphabetical order. I have done everything except been able to count the sum of the numbers, it gives me the last number in the text file for essi and pietari. Here is my code:

```
def main():

    filename =  input("Enter the name of the score file: ")
    read_file = open(filename, mode="r")

    score = {}
    for line in read_file:
        line = line.rstrip()
        name, points = line.split(" ")
        score[name] = points

    print("Contestant score:")

    for key in sorted(score):
        print(key,score[key])

if __name__ == "__main__":
    main()

```

And it gives this:

```
Enter the name of the score file: game.txt
Contestant score:
aps 25
essi 1
pietari 7

Process finished with exit code 0

```

So basically what I need is for the result to be:

```
Enter the name of the score file: game.txt
Contestant score:
aps 25
essi 8
pietari 26

Process finished with exit code 0

```