Solve Problems by Coding Solutions - A Complete solution for python programming
lst = [('for', 3), ('python', 9), ('engineers', 10)]
print("The original list is : " + str(lst))
ord_list = ['python', 'for', 'engineers']
temp = dict(lst)
res = [(key, temp[key]) for key in ord_list]
print("The ordered tuple list : " + str(res))
Post a Comment
No comments:
Post a Comment