मराठी

Consider the following tuples, tuple1 and tuple2: tuple1 = (23,1,45,67,45,9,55,45) tuple2 = (100,200) Find the output of the following statement: p r i n t ( s o r t e d ( t u p l e 1 ) )

Advertisements
Advertisements

प्रश्न

Consider the following tuples, tuple1 and tuple2:

tuple1 = (23,1,45,67,45,9,55,45)
tuple2 = (100,200)

Find the output of the following statement:

p r i n t ( s o r t e d ( t u p l e 1 ) )
print(tuple1)
टीपा लिहा
Advertisements

उत्तर

The 'sorted()' function takes an element in the tuple and returns a new sorted list. It doesn’t make any changes to the original tuple. Hence, print(tuple1) will print the original tuple1 i.e. (23, 1, 45, 67, 45, 9, 55, 45)

OUTPUT: 
[1, 9, 23, 45, 45, 45, 55, 67]
(23, 1, 45, 67, 45, 9, 55, 45)

shaalaa.com
Tuple Methods and Built-in Functions
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 10: Tuples and Dictionaries - Exercise [पृष्ठ २२४]

APPEARS IN

एनसीईआरटी Computer Science [English] Class 11
पाठ 10 Tuples and Dictionaries
Exercise | Q 1. viii. | पृष्ठ २२४
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×