Maple Leafs (file input)
For this challenge, use the requirements for challenge A-3 in the 1992 Niagara South Programming Competition.
For the input, create a text file called "MapleLeafs.txt" with the scores entered as follows:
2 4
5 3
12 5
1 7
3 3
1 5
6 2
12 1
3 6
1 1
The following Python examples shows how you can read in the individual scores. Note that individualScores[0] and individualScores[1] would be the goals for the 1st game, individualScores[2] and individualScores[3] for the 2nd game, etc.
#Python Example to read in scores
# initialize the arrays
gameScores=[]
individualScores=[]
# open file, read the scores into the array, close file
file = open("MapleLeafs.txt", "r")
gameScores = file.read()
file.close()
# split the gameScores into separate scores
individualScores = gameScores.split()
Save as "NS1992A3-MapleLeafs".