ExecTimeoutException: Program took too long to terminate

Hello, I’ve been learning Pyhton and since I joined to CodaAcademy, It always appears an error when I want to input something.

Now I’m stuck because if I don’t input on my code, I won’t be able to continue.

Welcome to the Pig Latin Translator!
Enter a word:Traceback (most recent call last):
File “python”, line 4, in
ExecTimeoutException: Program took too long to terminate

It was the error, Could anyone help me?

Thanks.

1 Like

Hi @danielamontoya540302, welcome to the forum.

That’s helpful. It’d be more useful, though, if we also had the code you ran to produce that error.

The Codecademy forum provides a quick and easy way to post properly-formatted code. All you need to do is look for the </> icon in the menu bar which appears at the top of the text box while you type.

capture

Press Enter to go to a blank line, click that icon, and you will see this:

capture_r

Just copy and paste your code directly from the editor into that highlighted portion, and all of the nicely-readable formatting will be preserved! Moreover, it will be in a format that can be directly copied and pasted into an IDE for testing. :slight_smile:

1 Like

Hi! I have the same exact issue when working on the Python 2 course Pig Latin Translator lesson. The error I get is “ExecTimeoutException: Program took too long to terminate.”

Here is a snippet of my code directly from the online editor:

print 'Welcome to the Pig Latin Translator!'

# Start coding here!
original = raw_input("Enter a word:")

Any help would be greatly appreciated. I am using chrome and have disabled my browser extensions.

Did you provide the requested input to your program, or did you just leave it sitting there?

I clicked on the black console and typed a single word, which did not appear in the console, and then hit enter. Are we supposed to see what we are typing in the console?

Try clicking in the console a few times or even on the actual cursor. It’s a bit buggy but it’ll eventually work :slight_smile: Just had to deal with the same issue.

3 Likes

I just tried clicking on the actual cursor and got it to work. Thanks!

I found that I first had to click in the console window, then type my input, then click in the console window again before finally pressing ‘enter’ on my keyboard.

I’m still getting the time out error to which everyone refers - even if I get the codecademy solution via the Get unstuck button:

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
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:
  print "You missed my battleship!"
  board[guess_row][guess_col] = "X"
  print_board(board)

image
Can any one help?

See if the suggestions on this topic work.

2 Likes

thanks dr_victoria. I closed down my browser and then re-opened it; traceback error now no longer returns and I have been able to progress.

2 Likes

I know this is an old thread, but it was the first I encountered when I googled so I just want to contribute with my solution for this. I get this all the time, even when clicking in the console and when running the code that I got from the solution.

Sometimes it works just reloading, but most times I need to do a hard reload by hittting ctrl + shift + R. The hard reload bypasses the cache while reloading. That way you probably won’t need to restart your browser or delete your cache. If hard reload fails, I would try those two.

you could also use this code:

from random import randint

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)

def game():
board =

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

print_board(board)

ship_row = random_row(board)
ship_col = random_col(board)
print(ship_row)
print(ship_col)
guess_row = int(input("Guess Row: "))
guess_col = int(input("Guess Col: "))

# 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)
    from random import randint





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

print_board(board)

ship_row = random_row(board)
ship_col = random_col(board)
print(ship_row)
print(ship_col)
guess_row = int(input("Guess Row: "))
guess_col = int(input("Guess Col: "))

# 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)

game()