pyassistant

String Sorting by Length

Given a list of strings, write a function to sort the list based on the length of the strings. If two strings have the same length, maintain their relative order.

Example:

Input:
['apple', 'banana', 'kiwi', 'orange']
Output:
['kiwi', 'apple', 'banana', 'orange']

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.