pyassistant

String Sorting with 'x' Prefix

Given a list of strings, return a new list with the strings sorted in increasing order, except any strings that start with 'x' should come first in the list in lexicographic order.

Example:

Input:
['mix', 'xyz', 'apple', 'xanadu', 'aardvark']
Output:
['xanadu', 'xyz', 'aardvark', 'apple', 'mix']

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.