Computer Science
What are the differences between tuple and dictionary?
Python Tuples
4 Likes
Answer
Tuple | Dictionary |
---|---|
Tuples are ordered collection of elements. | Dictionaries are unordered collection of key-value pairs. |
Tuples are immutable. | Dictionaries are mutable. |
Tuples are enclosed in parentheses (). | Dictionaries are enclosed in curly braces {}. |
Elements of tuples can be accessed by index. | The items in a dictionary are accessed by keys. |
Answered By
2 Likes