What's the difference between lists and tuples in Python?

PythonServer Side ProgrammingProgramming

List and Tuple are called as sequence data types of Python. Objects of both types are comma separated collection of items not necessarily of same type. However, main difference between list and tuple is that list object is mutable whereas tuple object is immutable. Immutable object can not be modified once it is created in memory. Hence it is not possible to add, modify or remove item from tuple object. On the other hand these operations can be performed on a list.

Updated on 30-Jul-2019 22:30:21