जब निम्न कोड चलाया जाता है तो क्या प्रिंट होता है?
What is printed when the following code is run?
tup = ('30', '3', '2', '8')
print(sorted(tup, reverse = True)) A
['2', '3', '30', '8']
B
['2', '3', '8', '30']
C
['30', '8', '3', '2']
D
['8', '30', '3', '2']
Explanation
The sorted() function sorts the tuple elements in reverse lexicographical (alphabetical) order.
For the tuple ('30', '3', '2', '8'), the sorted order in reverse is:
['8', '30', '3', '2'].
So, the correct answer is (D).
Correct Answer: C) ['30', '8', '3', '2']