Tuple is the immutable list. Once you create a tuple, you can't change it in any way.
Tuple the same place as the list
Defining tuple is the same way as defining a list, except that the entire set of elements is surrounded by parentheses rather than square brackets.
The Tuple elements are sorted in the order defined by the list. The tuples index is the same as the list starting at 0, so the first element of a non-empty tuple is always t[0].
The negative index counts as the list from the tail of the tuple.
The same fragment (slice) as the list can also be used. Note that when you split a list, you get a new list, and when you split a tuple, you get a new tuple.
Tuple no way to exist
You cannot add elements to tuple. Tuple There is no append or Extend method.
You cannot delete an element from tuple. Tuple does not have a remove or pop method.
You cannot find elements in tuple. Tuple There is no index method.
However, you can use in to see if an element exists in tuple.
With the benefit of Tuple
Tuple is faster than list operation. If you define a constant set of values, and the only thing to do with it is to iterate over it, use tuple instead of the list.
You can make your code more secure if you write-protect data that you do not need to modify. Using tuple instead of a list is like having an implied assert statement that the data is constant. If you have to change these values, you need to perform a tuple to list conversion.
The conversion of Tuple and list
Tuple can be converted to a list and vice versa. The built-in tuple function receives a list and returns a tuple with the same element. The list function receives a tuple and returns a list. In effect, tuple freezes a list, and the list thaws a tuple.