Page 155 -
P. 155
names and numbers
The file contains more than numbers...
To see what happened, let’s take another look at the judge’s score sheet
to see if you missed anything:
The judge's official ID There are two pieces
of information on
badge was covering up the Name Score each line: a name and
Official Judging Dude Juan 9.12
names. Johnny 8.65 a number (the surfer's
score).
8.45
Joseph
Brad
Stacey
8.05
Aideen 7.81
Zack 7.21
Aaron 8.31
The judges also recorded the name of each surf contestant next to his or
her score. This is a problem for the program only if the name was added
to the results.txt file. Let’s take a look:
Johnny 8.65
Juan 9.12
Joseph 8.45
The results Stacey 7.81 The results in the file
file. look like this.
Aideen 8.05
Zack 7.21
Aaron 8.31
Sure enough, the results.txt file also contains the contestant names.
And that’s a problem for our code because, as it iterates through the file,
the string you read is no longer just a number.
120 Chapter 4