🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

जब निम्न कोड चलाया जाता है तो क्या प्रिंट होता है?

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']

Latest Updates