Yes. It’s called a
So, instead of
[1,2] which is a
list and which can be mutated,
(1,2) is a
tuple and cannot.
tuple cannot be instantiated by writing
(1), instead, you need to write
(1,). This is because the interpreter has various other uses for parentheses.
You can also do away with parentheses altogether:
1,2 is the same as
Note that a tuple is not exactly an immutable list. Click here to read more about the differences between lists and tuples