5 Best Ways to Sort by Rear Character in Python String Lists
π‘ Problem Formulation: Suppose we have a list of strings and we want to sort it based on the last character of each string, disregarding the other characters. For example, given the input [‘banana’, ‘apple’, ‘orange’], our desired output would be [‘banana’, ‘orange’, ‘apple’] because the last characters sorted alphabetically are ‘a’, ‘e’, and ‘n’. … Read more