Strange output


i passed the lesson but i do not understand why is the output that i was supposted to print was not equal to the raw_input things that i wrote : row and col.

Replace this line with your code. 

from random import randint

board = []

for x in range(0,5):
    board.append(["O"] * 5)
#makes 5 rows and cols 
def print_board(board):
    for row in board:
        print " ".join(row)
#prints the output pretty

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
print ship_row


Hi, @systemplayer29607 ,

You used raw_input to get values for guess_row and guess_col, but printed ship_col and ship_row, so there is a difference.


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