The week 9 table is ranked. Then the messages start. United’s captain says the Dynamo game finished 3-2, not 3-1, and the committee may yet void Athletic 2-2 Wanderers. Nadia’s results are fixed—a tuple in Python and a frozen array in the port—and they should stay that way because they’re what the captains reported.
So the script needs corrected results that leave the reported ones alone. In this lesson, you’ll ask JavaScript for changed copies of an array, frozen or not.
Ask for a Changed Copy
In Python, RESULTS is a tuple of tuples, so you can’t assign to its elements. Nadia builds new tuples from slices of the old one—one with the corrected match at the end and one without the Athletic draw:
RESULTS = (
("Rovers", 4, "Albion", 1),
("Athletic", 2, "Wanderers", 2),
("Dynamo", 3, "United", 1),
)
corrected = RESULTS[:2] + (("Dynamo", 3, "United", 2),) + RESULTS[3:]
counted = RESULTS[:1] + RESULTS[2:]
print(corrected[2])
print(counted)