11. Danger, Will Robinson


#1



11. Danger, Will Robinson!!


Error message says...O O O O O
O O O O O
O O O O O
O O O O O
O O O O O
Guess Row: 4
Guess Col: 5
2
4
You missed my battleship!
Traceback (most recent call last):
File "python", line 33, in
IndexError: list assignment index out of range


Why?


# Write your code below!
if guess_row==ship_row and guess_col==ship_col:
    print "Congratulations! You sank my battleship!"
else: 
    print "You missed my battleship!"
    board[guess_row][guess_col]="X"
    print print_board(board)


#2

5 is out of range. Recall that lists are zero-indexed.


#3

A post was split to a new topic: 11. danger will robinsion


#4

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