जब निम्न कोड चलाया जाता है तो क्या प्रिंट होता है?
What is printed when the following code is run?
tup = ('30', '3', '2', '8')
print(sorted(tup, reverse = True))
A)
B)
C)
D)
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).