Extra thinking danger will robinson


#1

Although i have used the hint list_name[x][y]
and got through the code
...also understood what it does.. i.e point to the location of the guess

now there are 2 things i don't understand
1. what does this line of code do.. ? is it like pointing to index in a list??
2. Also the board is 5 X 5.. it doesn't provide any check if i provide any value >4
if i had to do that i should be using a if , else statement when i define guess_col, guess_row variable?

eg
if guess_row>=4: (as python starts at0)
print ("kindly put a number between 0-4")
else :
return guess_row

is this code correct

thank you.!!


#2

The board is a list of lists.

board[row]

will be,

['O', 'O', 'O', 'O', 'O']

and,

board[row][col]

will be,

'O'

Notice that the first index is in the main list, the second is in the row list.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.