What is the difference between a list and a tuple in Python?
Correct answer
A. Lists are mutable, while tuples are immutable.
16 views
A. Lists are mutable, while tuples are immutable.
16 views
Lists are mutable, while tuples are immutable. You can add, remove or change the items of a list after creating it, but a tuple's contents are fixed.
Both are ordered and both can hold any data type. Because tuples cannot change, they are slightly faster and can be used as dictionary keys.
Keep preparing with more Computer Science MCQs on MCQsExam.com.
Not sure why the answer is A? Ask here and get an explanation.