saving . . . saved List and Tuple has been deleted. List and Tuple has been hidden .
List and Tuple
The basic difference between list and tuple

Python-3.4.3 Getting-started-with-Lists 05-06 min 10-20 sec 22-06-19, 10:28 a.m. NiharikaTitli


The list is an Data structure similar to an array. It is mutable, meaning that the same list object can be changed.

Tuple on the other hand is a immutable data structure and cannot be changed, hence one has to create a new tuple in case of changes
22-06-19, 10:31 a.m. ankitrj.iitb
Then why basically a tuple is used? If it is immutable, then where it is used.
22-06-19, 10:57 a.m. NiharikaTitli
It is used in situations where you prefer that the data should not change. In fact function arguments and return values are tuples
22-06-19, 5:02 p.m. ankitrj.iitb

Login to add comment

The key difference is that tuples are immutable. This means that you cannot change the values in a tuple once you have created it. This is a good feature to have in some data structures where you intend to not make any changes to certain parts. As a list is mutable, it can't be used as a key in a dictionary because dictionaries can use any immutable object as a key. Thus, tuples can be used as dictionary keys if needed. If you try to modify a tuple in a permitted way it becomes two Tuples: the original, which remains fo every scope other than yours, and your modified copy for your scope.
22-05-20, 11:38 a.m. bennetcole

Log-in to answer to this question.