Python - Tuples
Python tuples store data in a fixed order and are immutable, meaning their elements cannot be changed.
my_tuple = (True, False, 1, 0)
Tuples indexes are zero-based, meaning they start counting from zero.
Access Tuple Items
To access a tuple item, use the index inside square brackets [index]
.
x = ('a', 'b', 'c', 'd')
print(x[1]) # 'b'
Tuple Length
To obtain the length of a tuple use len(x)
.
x = ('a', 'b', 'c', 'd')
print(len(x)) # 4