Exercise: sort scrores

See other exercises.

In this exercise you a file with scores. Each line has a name and a number (a score) separated by a comma.

examples/data/score_data.txt

Foo,23
Bar,70
Baz,92
Bozo,17
Gozo,52
Dardon,20
Mekodra,23

The first task is to read in the file and print out the names with their scores ordered by name givin the following result:

Bar      70
Baz      92
Bozo     17
Dardon   20
Foo      23
Gozo     52
Mekodra  23

The second task is to print them ordered by scores resulting in:

Baz      92
Bar      70
Gozo     52
Foo      23
Mekodra  23
Dardon   20
Bozo     17

Tools

Solutions