pyassistant

Sort Strings by Length

Write a function that takes a list of strings and returns the strings sorted based on the length of each string, from shortest to longest.

Example:

Input:
['apple', 'banana', 'kiwi', 'orange', 'pear']
Output:
['kiwi', 'pear', '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.