8. ...and Seek!


#1



https://www.codecademy.com/courses/python-beginner-en-4XuFm/0/8?curriculum_id=4f89dab3d788890003000096#

Oops, try again. Make sure your prompts are exactly as written in the instuctions. No changing the capitalization or using extra spaces!

I would have expected that it does not matter wether I type "Guess row: " or "Guess Row: ", but it does.
Row (and Col) need to be capitalized and then it works, but I do not understand why they need to be capitalized?


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: "))


#2

it should be Guess col:, normally this doesn't matter, but the exercise validation can sometimes be case-sensitive while it is not necessary.


#3
  • stetim94
    Do you mean change "Guess row:" to "Guess Row:"? This worked for me.

#4

yea, you are right. It should be Guess Row


#5

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