TUPLES (IMMUTABLE LISTS)
Python supports a data type called a tuple that consists of comma-separated values without brackets (square brackets are for lists, round brackets are for arrays, and curly braces are for dictionaries). Various examples of tuples can be found online:
https://docs.python.org/3.6/tutorial/datastructures.html#tuples-and-sequences
The following code block illustrates how to create a tuple and create new tuples from an existing type.
Define a tuple t as follows:
>>> t = 1,'a', 2,'hello',3
>>> t
(1, 'a', 2, 'hello', 3)
Display the first element of t:
>>> t[0]
1
Create a tuple v containing 10, 11, and t:
>>> v = 10,11,t
>>> v
(10, 11, (1, 'a', 2, 'hello', 3))
Try modifying an element of t (which is immutable):
>>> t[0] = 1000
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'tuple...