# Write a Python program to Replace String by Kth Dictionary value # Python3 code to demonstrate working of # Replace String by Kth Dictionary value  # Using list comprehension  # initializing listtest_list = ["Gfg", "is", "Best"]  # printing original listprint("The original list : " + str(test_list))  # initializing subs. Dictionarysubs_dict = {    "Gfg" : [5, 6, 7],     "is" : [7, 4, 2], }  # initializing K K = 2  # using list comprehension to solve# problem using one linerres = [ele if ele not in subs_dict else subs_dict[ele][K]                                     for ele in test_list]          # printing result print("The list after substitution : " + str(res))