14/19 though it is correct ,but


#1

No matter what I type it always shows up you guessed that one already


#2

Try taking out the else statement and moving to to the end of the if statement. also change the second if statement to an elif statement. if doesnt work show me what it does or send me code so i can try it myself


#3

Which "else" statement are you talking about? I need to see the change in code to figure out what you mean. I'm having the same problem too.


#4

This Is There Code

if guess_row==ship_row and guess_col==ship_col:
    print "Congratulations! You sank my battleship!"
elif guess_row!=ship_row or guess_col!=ship_col:
    print "You missed my battleship!"
    board[guess_row][guess_col] = "X"
    print_board(board)
else:
    print board(board)
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."

This Is What I Meant

if guess_row==ship_row and guess_col==ship_col:
    print "Congratulations! You sank my battleship!"
elif guess_row!=ship_row or guess_col!=ship_col:
    print "You missed my battleship!"
    board[guess_row][guess_col] = "X"
    print_board(board)
elif 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 board(board)