pyassistant

String Sorting

You are given a list of strings. Write a function that returns a new list with the strings sorted in descending order by their length. If two strings have the same length, sort them in alphabetical order.

Example:

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