I know I'm doing something wrong, but what is it?


spits back: Traceback (most recent call last):
File "python", line 35, in
NameError: name 'i' is not defined

if guess_row == ship_row and guess_col == ship_col:
    print "Congratulations! You sank my battleship!"
    print "You missed my battleship!"
    guess_row = i
    guess_col = j
    board[i][j] = "X"


i and j are not defined. Perhaps you are trying to write this?

i = guess_row
j = guess_col

If so, I would suggest not doing it since we were not instructed to create any secondary variables.



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