Not Again!


#1



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


The UI keeps telling me "Oops, try again.Did you remember to add the "You guessed that one already" message to your elif statement?"


I expect the code to let me continue to the next exercise even after I debugged by setting coordinates (0,1) to equal X so I could test the statement.

Pardon the rude language in the print statements, I was just trying to have my own fun with them.


from random import randint

board = []

for i 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

board[0][1] = 'X'

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

# Write your code below!
if guess_col not in range(5) or guess_row not in range(5):
    print "You think you can wage war on space?!"
    print_board(board)
elif guess_row == ship_row and guess_col == ship_col:
    board[guess_row][guess_col] = 'Y'
    print_board(board)
    print "Fuck you, you son of a bitch! I'll kill your parents!"
elif board[guess_row][guess_col] == 'X':
        print "You guessed that one already"
else:
    board[guess_row][guess_col] = 'X'
    print_board(board)
    print "You dare fire upon my war vessel?!"


#2

strings printed need to be an exact match, copy paste them from the instructions

don't use additional print statement, it might trick error messages


#3

I figured out the problem....I forgot the period at the end of the print statement.


#4