27th Oct 2018, 5:10 PM
I Am Arthur
I Am Arthur - avatar
9 Réponses
+ 2
because your 2nd for loop sets pos as the 9th iteration THEN prints it. you're telling it to count to nine then tell you what number it's on. you should instead tell it to count to 9, and for every number tell you what number its on. which is simply putting the print in the for loop. for i in range(10) pos= i, campo[i].index("x") print(pos)
27th Oct 2018, 6:50 PM
Ahri Fox
Ahri Fox - avatar
+ 2
#then do an if statement if campo[i] == "x": pos=i
27th Oct 2018, 7:34 PM
Ahri Fox
Ahri Fox - avatar
+ 2
Arthur #oh right. I forgot. same thing still applies, except its: if "x" in campo[i]: pos=i
27th Oct 2018, 7:39 PM
Ahri Fox
Ahri Fox - avatar
+ 1
Ahri Fox But pos is the variable to know where the "x" is located
27th Oct 2018, 7:31 PM
I Am Arthur
I Am Arthur - avatar
+ 1
Ahri Fox But campo is an array inside an array
27th Oct 2018, 7:36 PM
I Am Arthur
I Am Arthur - avatar