Not again


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!"
    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."
        print "You missed my battleship!"
        board[guess_row][guess_col] = "X"


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


hey can you please post the whole code for this?


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


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