DS160123 What are lists and tuples? What is the key difference between the two?

Lists and Tuples are both sequence data types that can store a collection of objects in Python. The objects stored in both sequences can have different data types . Lists are represented with square brackets ['rishav', 9, 0.29] , while tuples are represented with parantheses ('raj', 5, 0.67) .
But what is the real difference between the two? The key difference between the two is that while lists are mutable , tuples on the other hand are immutable objects. This means that lists can be modified, appended or sliced on the go but tuples remain constant and cannot be modified in any manner.

4 Likes

Good explanation :+1:
And also tuples are faster than list.

1 Like