- In python Tuple is used to store the sequence of immutable Python objects.
- It is similar to lists since the value of the items stored in the list can be changed.
- If the tuple is immutable then the value of the items stored in the tuple cannot be changed.
- It can be written as the collection of comma-separated (,) values enclosed with the small () brackets.
- The parentheses are optional but it is good practice to use.
- A tuple is indexed in the same way as the lists then items in the tuples can be accessed by using their specific index value.
- Using negative indexing tuple element can also access then index of -1 denotes the rightmost element and -2 to the second last item and so on.
- The tuple items cannot be deleted by using the delkeyword as tuples are immutable, unlike lists.
- We can use del keyword with the tuple name, to delete an entire tuple.
- Concatenation (+), Membership (in), repetition (*) are the operators works in the same way as they work with the list.
- Using tuple instead of list gives us a clear idea that tuple data is constant and must not be changed.
- It can simulate a dictionary without keys and it can be used a dictionary which is consider the following nested structure.
W