मराठी

What advantages do tuples have over lists?

Advertisements
Advertisements

प्रश्न

What advantages do tuples have over lists?

टीपा लिहा
Advertisements

उत्तर

The advantages of tuples over the lists are as follows:

  1. Tuples are faster than lists.
  2. Tuples make the code safe from any accidental modification. If data is needed in a program that is not supposed to be changed, then it is better to put it in ‘tuples’ than in ‘list’.
  3. Tuples can be used as dictionary keys if it contains immutable values like strings, numbers, or other tuples. ‘Lists’ can never be used as dictionary keys as ‘lists’ are mutable.
shaalaa.com
Concepts of Tuples in Python
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 10: Tuples and Dictionaries - Exercise [पृष्ठ २२४]

APPEARS IN

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

Englishहिंदीमराठी


      Forgot password?
Use app×