# Write a Python program to Sort String by Custom Integer Substrings # Python3 code to demonstrate working of# Sort String by Custom Substrings# Using sorted() + zip() + lambda + regex()import re# initializing listtest_list = ["Good at 4", "Wake at 7", "Work till 6", "Sleep at 11"]# printing original listprint("The original list : " + str(test_list))# initializing substring listsubord_list = ["6", "7", "4", "11"]# creating inverse mapping with indextemp_dict = {val: key for key, val in enumerate(subord_list)}# custom sortingtemp_list = sorted([[ele, temp_dict[re.search("(\d+)$", ele).group()]] \                for ele in test_list], key = lambda x: x[1])# compiling resultres = [ele for ele in list(zip(*temp_list))[0]]         # printing resultprint("The sorted list : " + str(res))