A tuple, like a list, represents a sequence of zero or more objects of any type. Unlike mutable lists, though, tuples cannot be modified in place; that is, they are immutable.
To create a tuple, place zero or more values between parentheses with commas between them. If there is only one value, place a comma after it. The examples shown below are tuples containing four, one, and zero values respectively:
("red", 255, 0, 0)
(10,)
()All the operations described in intrinsics for sequences apply to tuples.
When to use tuples:
Whenever you want to form a sequence whose contents will not change.
Tuples are required by Python in some places, such as when using the string format operator.
Creating a tuple is faster and uses less memory than creating a list of the same size.