Think of a tuple as a list, except it is immutable, meaning that it cannot be changed after you've created it.
Tuples use rounded parentheses ()
instead of the square brackets []
used
for lists.
Here's an example of creating some tuples:
tuple_1 = (1, 2, 3)
tuple_2 = ()
tuple_3 = ("foo", "bar")
Sometimes you have to use a tuple instead of a list. For example, tuples are hashable while lists are not. This means that you can use a tuple as keys in a dictionary, for example.