Tuples

Python Tuple is a collection of Python Programming objects much like a list. The sequence of values stored in a tuple can be of any type, and they are indexed by integers. Values of a tuple are syntactically separated by ‘commas‘. Although it is not necessary, it is more common to define a tuple by closing the sequence of values in parentheses. This helps in understanding the Python tuples more easily.

# Creating a Tuple
Tuple1 = ('Hello', 'world',1,2,3,10.2)

print("\nTuple values:")
print(Tuple1)

print(Tuple1[0],type(Tuple1[0]))
print(Tuple1[3],type(Tuple1[3]))
print(Tuple1[-1],type(Tuple1[-1]))