# tuple has () whereas List has [] ----IMP
#tuple stores multiple values of different type
# tuple() is ordered and unchangeable i.e immutable
# immutable means
# we cannot insert a new value
# we cannot append a value
# we cannot remove a value
# we cannot modify an existing value
#List[] is ordered and changeable i.e mutable
#Example 1: creating a tuple
#mytuple=("Apple","banana","cherry")
#print(mytuple)
#Example2 Accessing Tuple items
# mytuple=("Apple","banana","cherry")
# print(mytuple[1]) # banana #1 is the index and index starts from 0 ,has []
#
# mytuple=() # This is an empty tuple
#Example3: Accessing tuple items using index
# mytuple=("Apple","banana","cherry")
# print(mytuple[-1],mytuple[-2]) #cherry banana
# Example 4: Accessing tuple items through Range of index
# mytuple = ("Apple","banana","cherry","orange","Mango","Grapes","melon")
# print(mytuple[2:5]) #('cherry', 'orange', 'Mango') range goes upto n-1 only
# print(mytuple[-4:-1])
#Example 5: To change tuple items
# By default, tuple doesnot allow to modify items bcz it is IMMUTABLE
#but,we can convert a tuple to list,change the items and
# convert the List back to tuple
# mytuple=("Apple","banana","cherry")
# mylist = list(mytuple)
# print(mylist) #['Apple', 'banana', 'cherry']
# mylist[0] = "orange"
# print(mylist) #['orange', 'banana', 'cherry']
# mytuple = tuple(mylist)
# print(mytuple) #('orange', 'banana', 'cherry')
# Example5: Accessing items of tuple using for loop
# mytuple = ("Apple","banana","cherry","orange","Mango","Grapes","melon")
# for i in mytuple:
# print(i)
#Example 6: To check whether an item is present in a tuple or not
# mytuple = ("Apple","banana","cherry","orange","Mango","Grapes","melon")
#
# if "cherry" in mytuple:
# print("Yes ,cherry is present in tuple")
# else:
# print("cherry is not present")
#Example7 : length of tuple
# mytuple = ("Apple","banana","cherry","orange","Mango","Grapes","melon")
# print(len(mytuple)) #7
# Example8: Add items to tuple---NOT POSSIBLE--- BCZ TUPLE IS IMMUTABLE
#but can convert to a list,change,again convert back to tuple
#Example 9: copy a tuple
# mytuple1 = ("red","green","yellow")
# mytuple2 = mytuple1
# print(mytuple2) #("red","green","yellow")
#Example 10: Removing items from tuple ---- Not possible---bcz IMMUTABLE
#Example11: join/combine 2 tuples
# mytuple1 = ("a","b","c")
# mytuple2 = (1,2,3,4)
# mytuple3 = mytuple1 + mytuple2
# print(mytuple3) ('a', 'b', 'c', 1, 2, 3, 4)
#Example12: Comparing two Tuples/Lists
# mytuple1 = (10,20,30)
# mytuple2 = ("abc","def","ghi")
# mytuple3 = (10,20,30)
# if mytuple1 == mytuple2:
# print("yes, two tuples are equal")
# else:
# print("two tuples are not equal")
# #-------
# if mytuple1 == mytuple3:
# print("yes, two tuples are equal")
# else:
# print("two tuples are not equal")
# #--------
# mylist1 = [10,20,30]
# mylist2 = ["A","b","c"]
# mylist3 = [10,20,30]
# if mylist1 == mylist2:
# print("yes, two lists are equal")
# else:
# print("two lists are not equal")
# #-------
# if mylist1 == mylist3:
# print("yes, two lists are equal")
# else:
# print("two lists are not equal")
#---------------END-----------