Exercise: add numbers
Given a file like this:
Foo:1
Foo:2
Foo:3
Foo:4
Foo:5
Foo:6
Foo:7
Foo:8
Bar:23
Foo:23
Foo:11
Foo:9
Bar:8
Zorg:7
- Add up the scores for each name and print the result.
Foo : 79
Bar : 31
Zorg : 7
- Make it work also on a file that looks like this:
# Let's start with Foo:1
Foo:1
Foo: 2
Foo :3
Foo : 4
Foo:5
Foo: 6
Foo :7
Foo : 8
# Let's start Bar with : 23
Bar:23
Foo: 23
Foo: 11
Foo : 9
Bar: 8
Zorg: 7