Nested List Indexing
Write a program to print the index of the given number N in the list of tuples.
Sample Input 1
4
Sample output 1
0 1
Sample Input 2
15
Sample output 2
1 1
listTuples=[(4,5,6,5),(3,1,2,7),(9,8,7,5)]
number=int(input())
index=0
for tuple in listTuples:
for t in tuple:
if t==number:
print(index,end=" ")
index+=1
Comments
Leave a comment