I have a nested loop. I want to iterate on a list of lists and check if a parameter is in a list, bring me back the list index.
parameter="Abcd"
li1=["ndc","chic"]
li2=["Abcd","cuisck"]
Li=[li1,li2]
for i in Li:
for j in i:
if (parameter==j):
x=i+1
print(x)
I expect an integer like for this example x=2. But it does not work. How can I do that?
print(Area)
to output? You never defined that name... And what do you expecti+1
to be wheni
is a string?for j in range(len(i))
and you will get the index you want