Help! 16. "Game Over"


#1

adicionar ao final as seguintes linhas:

if turn == 3:
    print "Game Over"

that's my code and It says: Oops, try again. Your code looks a bit off. Check the Hint if you need help! Your code threw the following error: unexpected indent (python, line 2)
I think I'm supposed put "else" above "if"


#2

Post your code. :slight_smile:


#3

adicionar ao final as seguintes linhas:
if turn == 3:
print "Game Over"


#4

it's supposed to be like #adicionar ao final as seguintes linhas:


#5

Can you post full code?


#6

adicionar ao final as seguintes linhas:

if turn == 3:
print "Game Over"


#7

Give me link of your problem page!


#8

Oops, try again. Your code looks a bit off. Check the Hint if you need help! Your code threw the following error: unexpected indent (python, line 2)


#9

for turn in range(4):
    guess_row = int(raw_input("Guess Row:"))
    guess_col = int(raw_input("Guess Col:"))

    if guess_row == ship_row and guess_col == ship_col:
        print "Congratulations! You sunk my battleship!"
    else:
        if (guess_row < 0 or guess_row > 4) or (guess_col < 0 or guess_col > 4):
            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 (turn + 1)

        if turn == 3:
            print("Game Over")
    print "Turn",turn + 1       
    print_board(board)

I think your code is not indented properly thats why you're getting the error!
I apologize for not able to understand your problem properly!
I hope it helps! :slight_smile:


#10

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