A quiz app keeps every player's score in a list, in the order the games were played. The results screen shows the top k scores, highest first.
Task: write top_k(scores, k) that returns a new list holding the k largest values in scores, from largest to smallest.
scores itself exactly as it was — the app still needs the original order.90 and both make the cut, 90 appears twice.k is a whole number, 0 or more. If k is bigger than the number of scores, return all of them, largest first.For example, top_k([42, 17, 88, 63, 5], 3) returns [88, 63, 42].