Computer Science
What advantages do tuples have over lists?
Python Tuples
1 Like
Answer
The advantages of tuples over lists are as follows:
Tuples use less memory whereas lists use more memory.
We can use tuples in dictionary as a key but it is not possible with lists.
Answered By
3 Likes
Related Questions
Assertion (A): Keys of the dictionaries must be unique.
Reasoning (R): The keys of a dictionary can be accessed using values.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Assertion (A): clear() method removes all elements from the dictionary.
Reasoning (R): len() function cannot be used to find the length of a dictionary.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
What are the similarities and differences between tuples and lists?
What is a key-value pair in dictionary?