0 out of 68 challenges solved

Sort students by age

**Question:**

Write a function called `sort_students` that takes a list of dictionaries representing students as input and returns a new list with the students sorted in ascending order based on their age. Use a while loop to iterate through each element in the list and perform the sorting using 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