My code runs forever


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/en/courses/python-beginner-en-4XuFm/0/8?curriculum_id=4f89dab3d788890003000096

<In what way does your code behave incorrectly? Include ALL error messages.>
So when I type in the code, it takes forever to run, i am wondering if I need to install something to get this
guess_row = int(raw_input("Guess Row: "))
guess_col = int(raw_input("Guess Col: "))
to run.

<What do you expect to happen instead?>

```python

Replace this line with your code.
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)

Add your code below!

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

<do not remove the three backticks above>

#2

raw_input() is a function which prompts the user for input, in this case, you are the user. You have to enter a guess, press enter to submit the guess


#3

Yes I did, I entered a guess and pressed enter, then It takes forever to have my code run through. (It seems like it keeps loading)


#4

It works fine, try refreshing the page or show a screenshot of the problem.


#5

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