Net-informations.com
SiteMap  | About    

Difference Between Tuple and List

The key difference is that tuples are immutable . This means that you cannot change the values in a tuple once you have created it. As a list is mutable , it can't be used as a key in a dictionary, whereas a tuple can be used.

The literal syntax of tuples is shown by parentheses {} whereas the literal syntax of lists is shown by square brackets [] .

Tuples are heterogeneous data structures (i.e., their entries have different meanings), while lists are homogeneous sequences.

Lists are for variable length , tuples are for fixed length .

Tuples show structure whereas lists show order .

Tuples have O(N) append, insert, and delete performance whereas Lists have O(1) append, insert and delete performance.









net-informations.com (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.