Tuple stores multiple data in the same variable. Tuples work the same as lists but in the case of the tuple they are immutable, you can not modify the values once defined.
In the list, we use square brackets but in tuples, we use round brackets.
Example 1:
numbers=(10,20,30,40,50)
print(numbers[0])
Output: 10
Example 2: Modifying values
numbers=(10,20,30,40,50)
numbers[0]=10
print(numbers[0])
Output Error: TypeError: ‘tuple’ object does not support item assignment
Support us by sharing this post