Sobes.tech
Junior — Senior

What will be the output? No. 29

livecode

Task condition

The task provides a dictionary where keys are names and values are people's ages. It requires sorting the dictionary elements by age in ascending order and outputting only the names in the resulting order.

let peopleAges = ["john": 23, "james": 24, "vincent": 34, "louis": 29]

let sortedNames = peopleAges.sorted(by: { $0.1 < $1.1 }).map { $0.0 }

print(sortedNames)

What will be the output printed to the console?