Ranking a list

Question Q2.4.3

Given an ordered list of test scores, produce a list associating each score with a rank (starting with 1 for the highest score). Equal scores should have the same rank. For example, the input list [87, 75, 75, 50, 32, 32] should produce the list of rankings [1,2,2,4,5,5].


Solution