Program:
#tuple Operationtuples=(1,2,5,9,6,2,4,2,8,5)
print("tuple=",tuples)
print("***Count Operation***")
n1=int(input(" Enter the Number to Search:"))
print(" ->>",n1,"comes",tuples.count(n1),"times in the tuple")
print("\n***Index Operation***")
n2=int(input(" Enter the Number to find its Index:"))
print(" ->>Index of",n2,"is",tuples.index(n2))
Expected O/P:
tuple= (1, 2, 5, 9, 6, 2, 4, 2, 8, 5)***Count Operation***
Enter the Number to Search:2
->> 2 comes 3 times in the tuple
***Index Operation***
Enter the Number to find its Index:9
->>Index of 9 is 3

0 Comments
Post a Comment