pyassistant

Sort Names by Length

Given a list of strings representing names, return a new list containing the names sorted in ascending order based on their length. If two names have the same length, maintain their original order.

Example:

Input:
['John', 'Alice', 'Bob', 'Eve', 'Ann']
Output:
['Bob', 'Eve', 'John', 'Alice', 'Ann']

Make sure you return your solution, don't print!

AI

Bot

Trying to solve my challenge? Ask if you must, or press the purple button so I can analyze your code.