PY-22
Order Records by Several Keys
Task
Write order_records(records). Each item in records is a dictionary with a
string group, a numeric score, and a string name.
Return a new list ordered by these keys, in this exact order:
groupascending;scoredescending within each group;nameascending when both earlier keys tie.
The input list and its dictionaries must not be changed. The result keeps the original record dictionaries, only changing their list order.
Example
The name decides the final tie inside group a; the score direction remains
descending.
Your implementation
Edit solution.py and keep this function name and signature:
Return a new list containing the original dictionaries in the stated order. Do not use an ID or source position as an extra ordering rule, print anything, or mutate the inputs.