This program sorts each list contained within a tuple and returns a new tuple with the sorted lists. Here's what happens step-by-step:
So the program takes a tuple that contains lists and tuples, sorts each list contained within the tuple, and returns a new tuple with the sorted lists.
val = ([10, 50, 60], [80, 20, 30], [70, 100, 40],(90,)) print("Original Tuple is : " , val) res = tuple((sorted(i) for i in val)) print("Tuple after sorting list : ",res)
Original Tuple is : ([10, 50, 60], [80, 20, 30], [70, 100, 40], (90,)) Tuple after sorting list : ([10, 50, 60], [20, 30, 80], [40, 70, 100], [90])
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions