Not again syntax error!


#1


Not again!!!

File "python", line 45
elif board[guess_row][guess_col] == 'X':
^
SyntaxError: invalid syntax


what is the problem with this code help me out...


Replace this line with your code. 
# Write your code below!
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)
    
if guess_row not in range(5) or \
guess_col not in range(5):
    print "Oops, that's not even in the ocean."
        
else:
    print "You missed my battleship!"
    board[guess_row][guess_col] = 'X'
    
elif board[guess_row][guess_col] == 'X':
    print "You guessed that one already"
print_board(board)


#2

from game flow logic perspective, does it make sense where you placed your elif to check if the user already guessed this coordinates?

walk through your game, does the order and logic make sense? What should be the order, you think?


#3

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