Tuple data types: Ordered ,Immutable, works on index number and () single value will not be called in tuple, and it is faster than list.

t = (2, 5, 7, 8)
a = t[0]
print(a)

For iteration

l = len(t)
for a in range(l):
	print(a)  # got index number
	print(t[a])  # print index of t
	print(" ")

for a in t:  # second method for iteration
	print(a)
	print("")

More function in tuple

m = min(t)  # print minimum
print(m)
mx = max(t)  # print maximum
print(mx)
print(min(t))  # another way to print minimum
c = t.count(2)  # print how many 2 elements are present in t tuple
print(c)
i = t.index(5)  # prints the index of 5 elements
print(i)
s = sum(t)  # works in integer and float ,gives the sum of all element
print(s)
s = sum(t, 10)  # add extra 10 on the total sum of the elements

SETS

Sets are unordered, with no index and no repetition; defined by set(). Note: A tuple also uses the () bracket.

Functions of set: set(), add(), pop(), remove(), clear(), discard() and update()

l= [10,20,30]
s= set(l) # it converts the other data types into set datatypes
print(s)

s.add(40)  # it adds new element in set in random position
print(s)

s.pop() # it removes any random element from s set and returns the element which is deleted
print(s)

s.remove(20) # it removes the element which is pass in remove if set is empty then it will show
# error but in discard function it will not show error
print(s)

s.discard(10)  # it is same as remove
print(s)

s.clear() # it returns set() function as an output
print(s)

li= [30,40,50,50]
s.update(li) # it updates or add new elements in set as well as converts it
print(s)