#tuple is an immutable sequence type, meaning that you cannot add, remove, or modify the items in a tuple once it is created. Tuples are similar to lists, but they are enclosed in parentheses (()) instead of square brackets ([]).
# Creating a tuple of integers
tuple1 = (1, 2, 3, 4, 5)
# Creating a tuple of floating-point numbers
tuple2 = (1.0, 2.5, 3.14, 4.2, 5.0)
# Creating a tuple of strings
tuple3 = ('red', 'green', 'blue', 'yellow', 'orange')
# Creating a tuple of mixed data types
tuple4 = (1, 'red', 3.14, 'green', 5)
# Creating a tuple from a list
list1 = [1, 2, 3, 4, 5]
tuple5 = tuple(list1)
# Creating a tuple from a string
string = 'Python is a great programming language'
tuple6 = tuple(string)
# Accessing the first item in tuple1
item = tuple1[0]
# Accessing the third item in tuple3
item = tuple3[2]
# Accessing the last item in tuple3
item = tuple3[-1]
# Accessing the first three items in tuple1
subtuple = tuple1[0:3]
# Accessing the last three items in tuple1
subtuple = tuple1[-3:]
# Accessing all items in tuple1 except the first and last
subtuple = tuple1[1:-1]
# Printing the tuples
print(tuple1)
print(tuple2)
print(tuple3)
print(tuple4)
print(tuple5)
print(tuple6)
# Printing the item and subtuple
print(item)
print(subtuple)
# Determining the data type of a tuple
print(type(tuple1)) # prints "<class 'tuple'>"