Write Python3 code to demonstrate working of Sort by Rear Character in Strings List Using sort()
Topic: Write Python3 code to demonstrate working of Sort by Rear Character in Strings List Using sort()
Solution
def get_rear(sub): return sub[-1] test_list = ['gfg', 'is', 'best', 'for', 'geeks'] print("The original list is : " + str(test_list)) test_list.sort(key = get_rear) print("Sorted List : " + str(test_list))
List all Python Programs