8. ...And Seek. Error with guess_row/col integer wrapping


#1

Link to the exercise: 8. ...And Seek.

When I click save and submit, it says: "Oops, try again. Make sure to wrap your prompts with 'int'."

This is my 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)

# Here's the problem:
def guess_row():
    guessrow = int(raw_input("Guess Row: "))
    return guessrow

def guess_col():
    guesscol = int(raw_input("Guess Column: "))
    return guesscol

Help would really be appreciated, and preferably not said in a condescending manner.

Thanks, Poisonbee.


#2

I've got to go now, so I'll see any replies tomorrow.


#3

I don't think you're supposed to set either of those variables inside a function. I think you're supposed to just set them.


#4

First of all you don't need to define functions , also have a look how u spelled Column and what does exercise asks you to write .


#5

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