Please help. what is 'list element'


#1

if guess_row == ship_row and guess_col == ship_col:
    print "Congratulations! You sank my battleship!"
else:
    print 'You missed my battleship'
    guess_row ['X']
    guess_col['X']
    print_board(board)

#2

at this point in the course, you should know what a list element is. I know that sound harsh, but its the truth.

we talked about list when creating the board, how we appended lists to board list


#3

if guess_row == ship_row and guess_col == ship_col:
    print "Congratulations! You sank my battleship!"
else:
    print 'You missed my battleship'
    guess_row.append(['X'])
    guess_col.append(['X'])
    print_board(board)

please help. Confused?


#4

you already created the board, why would you want to append to the board? we want to update the board, how do we update a list?


#5

if guess_row == ship_row and guess_col == ship_col:
    print "Congratulations! You sank my battleship!"
else:
    print 'You missed my battleship'
    board [guess_row] [guess_col] == 'X'
    print_board(board)

why dosent this work


#6

because two equal signs means check if equal. here we want to update our board, so we need to re-assign this value, which is done with a single equal sign


#7

if guess_row == ship_row and guess_col == ship_col:
    print "Congratulations! You sank my battleship!"
else:
    print 'You missed my battleship'
    board [guess_row] [guess_col] = 'X'
    print_board(board)

I thought that but I tried it and It didn't work


#8

it does, now you only need to make sure You missed my battleship! is an exact match as given in step 2


#9

I cant believe that was all it was. thanks for the help. :slight_smile:


#10