13.13 Not Again!


#1


What exactly is wrong with this code?


#2

Let's discuss indexes of computer programming.

Ok, let's create a small loop to show us how Python counts,

list_ = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
for index, item in enumerate(list_):
    print("Index Pos: %s, Current Item: %s" % (index, item))

Ok, once you input this and get it's print out come back here. Or you can just click this LAB LINK.

Now, that we know how Python counts, let's go over why your code is throwing an error.

You are asking your user for input of 1-5 with 5 included. When they enter in 5 as you can tell from our print out it will give us index position 6 which from what I can see is out of your available index positions. You have to adjust your user entry accordingly to compensate for this.

That should be all, if you have any more questions feel free to ask.


#3

You gave Guess Row and Guess Col as 5. In line 31 - range(5) will only read till 4 (i.e 0,1,2,3,4).
Try giving your Guess below 5 if your range is 5