wiz-icon
MyQuestionIcon
MyQuestionIcon
2
You visited us 2 times! Enjoying our articles? Unlock Full Access!
Question

What advantages do tuples have over lists?

Open in App
Solution

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 a data is needed in a program which 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 another tuple. ‘Lists’ can never be used as dictionary keys as ‘lists’ are mutable.

flag
Suggest Corrections
thumbs-up
23
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Exploring Index Numbers
STATISTICS
Watch in App
Join BYJU'S Learning Program
CrossIcon