pyassistant

Descending Length Sort

Given a list of strings, return a new list with all the strings sorted in descending order based on their length. If two strings have the same length, preserve their order relative to each other.

Example:

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

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.