Given:
tuple1 = (('a', 23),('b', 37),('c', 11), ('d',29))
Expected output:
(('c', 11), ('a', 23), ('d', 29), ('b', 37))
Solution:
tuple1 = (('a', 23), ('b', 37), ('c', 11), ('d', 29)) tuple1 = tuple(sorted(list(tuple1), key=lambda x: x[1])) print(tuple1)
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Solution:
need an explanation for this answer? contact us directly to get an explanation for this answer