Sobes.tech
Junior — Senior

Sorting an array of dictionaries by ascending "age" field

livecode

Task condition

Given an array of dictionaries, each containing the key "age". The task is to sort this array in ascending order based on the value of the specified key.

Example 1: Input: [{'age': 30}, {'age': 10}, {'age': 34}, {'age': 32}] Output: [{'age': 10}, {'age': 30}, {'age': 32}, {'age': 34}]

people = [{'age': 30}, {'age': 10}, {'age': 34}, {'age': 32}]

You need to obtain a new list sorted by the "age" key.