Definition:
A Tuple is used to store data in an ordered way.
It is written inside parentheses ().
You cannot change its values (it is immutable).
It allows duplicate values.
You can access values using index numbers.
Now you will clearly understand through the flowchart .
Tuple → t = (10, 20, 20, 30, 40)
Index : 0 1 2 3 4
↓ ↓ ↓ ↓ ↓
Value : 10 20 20 30 40
Order → 10 → 20 → 20 → 30 → 40
↑ ↑
(duplicate) (duplicate)
Syntax:
tuple_name = (value1, value2, value3)
Example:
t = (10, 20, 20, 30, 40)
print(t)
Output:
Exercise
Create a tuple t = (5, 10, 15, 20) and print it using Python.
