8. and seek

I am also getting the same error and the error comes when I click run before I get to insert a number and type enter.

before you insert a number? Then something is wrong with your code, but you didn’t include code or error message, so its impossible for me to tell what is wrong

Please read this topic about making quality topics:

If you make a low quality topic, the response is also of lower qualitiy


Sorry, here is my code and error

1 from random import randint
3 board = []
5 for x in range(0,5):
6   board.append(["O"] * 5)
8 def print_board(board):
9   for row in board:
10     print " ".join(row)
12 def random_row(board):
13   return randint(0, len(board) - 1)
15 def random_col(board):
16  return randint(0, len(board[0]) - 1)
18 ship_row = random_row(board)
19 ship_col = random_col(board)
21 guess_row = int(raw_input("Guess Row: "))
23 guess_col = int(raw_input("Guess Col: "))

Guess Row: Traceback (most recent call last):
File “python”, line 21, in
ValueError: invalid literal for int() with base 10: ‘SCT’

unable to reproduce problem, try:

    guess_row = int(raw_input("Guess Row: "))
    guess_col = int(raw_input("Guess Col: "))
except ValueError:
    guess_row = 2
    guess_col = 3

ideally, quickly enter a number in the prompt (i tried and that worked)


Then I get the following error:

File “python”, line 23
except ValueError:
SyntaxError: invalid syntax

that can’t be, the code i posted is correct, i verified it.

Just refresh the page, the problem should solve itself. other people experiencing the same problem now got past


So, that seems to have worked and I progressed to the next lesson. Now the input field of that lesson is empty and whenever I type something in and push enter, nothing happens. Clicking “reset exercise” also gives a blank field. Is it an error with the whole website or something on my side? I also tried it in internet explorer and opera without success and cleared chrome cookies etc. and logged in again.

Several people seem to experience this problem, so it seems to be on codecademy, but no idea what the problem is, its been reported and will hopefully be fixed ASAP


I have the same problem and it’s been happening since yesterday, hope it gets fix soon. Many thanks!

this problem happened to me but i could somehow pass it and went to the following exercises but the same error message still exist when run the program even after copying the code was suggested and can not run the code or put any inputs:

the error is:
Traceback (most recent call last):
File “python”, line 22, in
ValueError: invalid literal for int() with base 10: ‘SCT’

the code i wrote is:
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)


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)
guess_row = int(raw_input("Guess Row: "))
guess_col = int(raw_input("Guess Col: "))

print ship_row
print ship_col

Write your code below!

if guess_row == ship_row and guess_col == ship_col:
print “Congratulations! You sank my battleship!”

see if you can temporary replace:

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


guess_row = 3
guess_col = 3
1 Like

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