Mitek Systems interview question

¿Difference between list and tuple in python?

Interview Answer

Anonymous

9 Apr 2025

A list is an ordered, mutable collection enclosed by square brackets. It can contain any data types. A tuple can also contain any data types and is ordered, but it immutable, meaning that that it can't be changed once created. It would have to be overwritten with an entirely new tuple with the desired changes. Tuples are enclosed by parentheses. Lists are immensely useful for iterating and when accessing the values within them to make changes or transformations to them. Tuples can be quite useful for moving rows of data that will not change from one object to another, whether within the working directory, memory or into external systems, such as databases.