0 of 464 solved

Sort students by age

Write a function `sort_students(students)` that returns a new list of student dictionaries sorted by age in ascending order.

For this challenge, keep the solution explicit by iterating through the input list before sorting with the `key` argument.

#### Example
Input:
[
    {"name": "Alice", "age": 20},
    {"name": "Bob", "age": 18},
    {"name": "Charlie", "age": 22}
]
Output:
[
    {"name": "Bob", "age": 18},
    {"name": "Alice", "age": 20},
    {"name": "Charlie", "age": 22}
]
def sort_students(students):
    """
    Sorts the given list of student dictionaries in ascending order based on their age.

    Args:
        students (list): The input list of student dictionaries.

    Returns:
        list: A new list with the students sorted based on their age.
    """
    # TODO: Implement the sort_students function
    pass