#Tuples are ordered, indexed collections of data
#Tuples can store duplicate values
#You cannot change the data of a tuple after that you have assigned it the values
#Like lists, it can also store several data items
#tuple unpacking
myTuple = ("Tim","9","Smith")
#tuple unpacking allows us to store each tuple element in a variable
#syntax - vars = tuple
"""NOTE: no of vars must equal no of elements in tuple"""
name,age,sirname = myTuple
print(name)
print(age)
print(sirname)
#extra
#this alows us to easily switch values of variables
name,sirname = sirname,name
print(name)
print(sirname)
#Accessing Tuple
#with Indexing
Tuple1 = tuple("Softhunt")
print("
First element of Tuple: ")
print(Tuple1[1])
#Tuple unpacking
Tuple1 = ("Python", "Softhunt", "Tutorials")
#This line unpack
#values of Tuple1
a, b, c = Tuple1
print("
Values after unpacking: ")
print(a)
print(b)
print(c)
# Creating an empty Tuple
Tuple1 = ()
print("Initial empty Tuple: ")
print(Tuple1)
# Creating a Tuple
# with the use of string
Tuple1 = ('Geeks', 'For')
print("
Tuple with the use of String: ")
print(Tuple1)
# Creating a Tuple with
# the use of list
list1 = [1, 2, 4, 5, 6]
print("
Tuple using List: ")
print(tuple(list1))
# Creating a Tuple
# with the use of built-in function
Tuple1 = tuple('Geeks')
print("
Tuple with the use of function: ")
print(Tuple1)
#A tuple is essentailly a list with limited uses. They are popular when making variables
#or containers that you don't want changed, or when making temporary variables.
#A tuple is defined with parentheses.