9. It's Not Cheating—It's Debugging!


I have been working on this code for so long and it keeps telling me there is an error in my syntax in line one, can anyone help me find out where I am going wrong.

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: "))
print ship_col(board)
print ship_row(board)


You have a '\x7f' (ascii 127) character before the f in from on the first line.

Please do tell how you managed that :stuck_out_tongue:


Hi sammie_scott03

I thik that you have extra spaces:
guess_row = int(raw_input("Guess Row: "))
in that it shoud be:
guess_row = int(raw_input("Guess Row:"))
with out no space between : and " in bout guess_row and gues_col