Bug in given code


In Battleship! lesson 7 ("Hide..."), the given code in line 5 and 6 is as follows:

for x in range(0, 5):
    board.append(["O"] * 5)

This brings up an error. Why?


Hi, @sycriia ,

We will need to see all of your code for this exercise in order to determine the problem, because it concerns how the lines that you have posted relate to the lines that precede it, and possibly to the ones that follow.

It might depend upon how you initialized your board variable, but could concern whether you redefined a built in function, such as range.

Please post all of your code.


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