Tuple using Python:

 Tuple using Python:

#tuple

"""
Tuple is a collection which is ordered and unchangeable.
Allows duplicate members.
Tuple has rounded brackets
"""
#defining tuple
import null as null

tuple=(1,2,3,4,5.222,6,"ff","qqqqqqqqqqqqqqqqqq",null)
print("tuple:",tuple)
tuple1=(9,11,22,33,9,9,9)
print("tuple1=(9,11,22,33)=",tuple1)

#length of tuple1
n=len(tuple1)
print("length of tuple1=",n)
#count 9 number of times present in tuple1

print("count 9 number of times present in tuple1=",tuple1.count(9))

Output:
tuple: (1, 2, 3, 4, 5.222, 6, 'ff', 'qqqqqqqqqqqqqqqqqq', <module 'null' from 'C:\\Python\\Python390\\lib\\site-packages\\null.py'>)
tuple1=(9,11,22,33)= (9, 11, 22, 33, 9, 9, 9)
length of tuple1= 7
count 9 number of times present in tuple1= 4







Comments