Not again


#1

This is my code, it works perfectly but is it correct?
And how will the elif part execute like what is the condition?

if guess_row==ship_row and guess_col==ship_col:
    print "Congratulations! You sank my battleship!"
else:
    if guess_row not in range(5) or guess_col not in range(5):
        print "Oops, that's not even in the ocean."
    elif board[guess_row][guess_col] == "X":
        print "You guessed that one already."
    else:
        print "You missed my battleship!"
        board[guess_row][guess_col] = "X"
        print_board(board)

#2

please continue with the course, you will add a loop, then you will see that elif can perfectly execute

We can't do all steps in one go, sometimes you take steps which come alive later


#3

hey can you please post the whole code for this?


#4

you will add this code in the next few exercises, just continue the course.


#5

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