3. Help on coding


#1

Hello All. I need a small help. Please tell me the issue here

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

I am getting this error

It looks like the rows are not represented as lists.

"""
board = []
for i in range(0,5):
board[I].append("O")

"""


#2

Why are you calling to board with i? Board is already a list.


#3

Read the small text before the instructions, just append what the exercise prints out. Also papusalaatti is right, you don't have to call board[i] just the board itself :wink:

cheers


#4

I am not getting your point. Still it is giving error.

board = []
for i in range (0,5):
    board.append('O')

Please help


#5

You must handle 'O' as a list. Also it looks like your board only contains one 'O' per line.


#6

@papusalaatti is right, this is currently your board:

board = []
for i in range (0,5):
    board.append('O')
print board

the print will output:

['O', 'O', 'O', 'O', 'O']

while you should have a 5x5 board:

[['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']]

#7

Hello All. Thank you for helping me. I have completed the Battle Ship.