8(iii)
Write a Python program that performs the following task:
1. Create a tuple having elements (50,60,70,80,90).
2. Convert the above tuple to list.
3. Sort all the elements in descending order.
4. Remove the element 80 from the above list and print the list.
5. Sort the above in ascending order.
6. Convert the final list to tuple.
7. Print the final tuple.
Show SolutionHide Solution↓
t = (50, 60, 70, 80, 90) l = list(t) l.sort(reverse=True) l.remove(80) print(l) l.sort() ft = tuple(l) print(ft)
[90, 70, 60, 50]
(50, 60, 70, 90)