What is wrong with my indentation?

from random import randint

board =

for x in range(0, 5):
board.append([“O”] * 5)

def print_board(board):
for row in board:
print " ".join(row)

print_board(board)

def random_row(board):
return randint(0, len(board) - 1)

def random_col(board):
return randint(0, len(board[0]) - 1)

ship_row = random_row(board)
ship_col = random_col(board)
print ship_row
print ship_col

for turn in range(4):
print “Turn”, turn + 1

guess_row = int(raw_input("Guess Row: "))
guess_col = int(raw_input("Guess Col: "))

Write your code below!

if guess_row == ship_row and guess_col == ship_col:
print “Congratulations! You sank 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_board(board)

why this error is comming ,how to solve it
Traceback (most recent call last): File “python”, line 25, in <module> ValueError: invalid literal for int() with base 10: ‘RUN’

I am getting the same error and when I click the solution button and I re do it the exact same way there is an error.

Instead of using raw_input, try setting your row and column manually. Comment out the two input lines.

Hello, thank you for your time!!

https://gist.github.com/085eed06ec6feb43a316fc5547427647

This is the link of my code right now and the answer is
Turn 1
Turn 2
Turn 3
Turn 4
and then the rest of the code.

Instead of showing the turn number in each turn…

It doesn’t loop to give another try… only one try and the game is over.

And if I do it this way… https://gist.github.com/09d35ade412bff3c255061d6547ac4f5

It gives me this error:
O O O O O
O O O O O
O O O O O
O O O O O
O O O O O
0
1
Guess Row: 1
Guess Col: 2
Guess Row: 3
Guess Col: 4
Guess Row: 5
Guess Col:
Traceback (most recent call last):
File “python”, line 28, in
ValueError: invalid literal for int() with base 10: ‘’

Lines 30 thru to the end need indentation so they are all in the for loop block.

But the error is being marked in the line 28

File “python”, line 28
guess_col = int(raw_input("Guess Col: "))
^
IndentationError: unexpected indent

The only two lines inside the loop block are 27 and 28. The error is not of your own making. There is a problem with raw_input that we have no control over. Try copying your code to repl.it and choose Python 2 if you wish to see the program run successfully. Be sure to check all your indentation.

As for completing the exercise on CC, you have two options…

  1. Get solution and move on; or.
  2. Create two lists and give them each four valid row and column numbers in any order.

The second will mean commenting out the input lines in your loop and assigning values from your lists.

guess_row = rows[turn]
guess_col = cols[turn]

It should work, but you may not pass the exercise and will need to revert to the first option to complete.

Thank you so much for your time.

On repl.it it works. It gives me Turn + 1 in each one of them but… at the last turn after I miss it tells me that it is out of range. Wich, it means that is correct because of the range 4 no?

I am still learning and I didn’t understand this:

The second will mean commenting out the input lines in your loop and assigning values from your lists.

guess_row = rows[turn]
guess_col = cols[turn]

if you haven’t touched on the list topic yet, then ignore that suggestion and just get the solution so you can move on.