The tuple
is used to store multiple items sequentially in one variable. It is similar to list
but unlike list it is immutable.
tuple_name = (item1, item2, item3)
tuple_name[index]
Note:
tuple
is immutable, which means its values at the indices cannot be changed unless there is a value swap.Tuple
can be combined using the addition operator.>>> cities = ("Kathmandu", "Beni", "Pokhara")
>>> print (cities[0])
Kathmandu
>>> print(cities[1])
Beni