I have a problem where I couldn;t find a way to sort a list of strings in such a way that the values that starts a digit sorted in the end, and value that starts with letters are at the start of the list
I have tried using sort
and sorted
methods with lambda but its always sort with numbers at the start of the list.
Here is what I have tried
if __name__ == "__main__":
l = ["9 1 7 2", "hell bag", "8 7", "deserve respect three", "phone exit retired"]
print(sorted(l))
and this gives me following output,,
['8 7', '9 1 7 2', 'deserve respect three', 'hell bag', 'phone exit retired']
I want following output instead,
['deserve respect three', 'hell bag', 'phone exit retired', '8 7', '9 1 7 2']