19. Extra Credit - Extra ship function not re-assigning values


The code doesn't run any error messages, but my debug consistently has the ships at a value of 0. So of course I hit them.
I forgot what the [0] is doing there I'd need to check back.

Ideally I am expecting ship2R (second ship row) and ship2C (second ship column) to generate fresh if they conflict with the location of the original ship created in the tutorial.

def ship2_gen(board):
   return randint(0, len(board[0]) - 1)
   #This defines the variables globally for the assign functions to edit.
ship2R = 0
ship2C = 0
def ship2_assignR(board):   
    ship2R = ship2_gen(board)
    if ship2R == ship_row or ship2R == ship_col:
        ship2R = ship2_gen(board)
    return ship2R
def ship2_assignC(board):   
    ship2C = ship2_gen(board)
    if ship2C == ship_row or ship2C == ship_col:
        ship2C = ship2_gen(board)
    return ship2C


print ship2R
print ship2C.


well, that logic will not work too well. first you need to check location pairs of your ship and not row and column seperatelly. in above extract, you generate random number in 2nd line and assume it to be a new row. then you want to check if that row is not occupied already - but as I said you need to check row and column together at the same time.
in 3rd line you check if your new row is equal to existing ship row or column - why do you want to compare row number with column number?
the logic for this task is not easy as it seems