pyassistant

String Sorting

Given a list of strings, return a new list with the strings sorted in increasing order of lengths. If two strings have the same length, sort them in lexicographic order.

Example:

Input:
['banana', 'apple', 'cherry', 'kiwi', 'mango']
Output:
['kiwi', 'apple', 'mango', 'cherry', 'banana']

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.