# Creating a tuple and storing the values tuple = ("Today's", "Date", "Is", 15, "August", 2019) print(tuple) print(type(tuple)) # Accessing the values of a tuple print(tuple[2]) print(tuple[5]) # Nesting two tuples as one tuple tuple1 = ("And", "its", "Thursday") print(tuple1) nest = tuple, tuple1 print(nest) # Tuples are immutable in nature print(tuple[0]) # Changing the value of the 0th index to "Hi" tuple[0] = ("Hi") print(tuple) # Storing identical data with a tuple tuple = ("Today's", "Date", "Is", 15, "August", 2019) print(tuple) tuple = [("Today's", "Date", "Is", 15, "August", 2019), ("Today's", "Date", "Is", 15, "August", 2019)] print(tuple) tuple = ("Today's", "Date", "Is", 15, "August", 2019) print(tuple) for i in tuple: print(i) # Accessing the index of the tuple using enumerate function. tuple = ("Today's", "Date", "Is", 15, "August", 2019) print(tuple) for counter, value in enumerate(tuple): print(counter, value) # Deleting an entire tuple using del tuple = ("Today's", "Date", "Is", 15, "August", 2019) tuple del tuple print(tuple) # Counting the number of times a value has appeared in the tuple tuple = ("Today's", "Date", "Is", 15, "August", 2019, "And", "Day", "Is", "Thursday") print(tuple) print(tuple.count("Is")) print(tuple.count(15)) # Counting the number of times a value has appeared in the tuple tuple = ("Today's", "Date", "Is", 15, "August", 2019, "And", "Day", "Is", "Thursday") print(tuple) print(tuple.index("Date")) print(tuple.index("August")) print(tuple.index("Is")) # Checking for the values present in the tuple tuple = ("Today's", "Date", "Is", 15, "August", 2019) print(tuple) # Case 1: if "August" in tuple: print(True) print(tuple.index("August")) else: print(False) # Case 2: if "September" in tuple: print(True) print(tuple.index("September")) else: print(False)