Found a bug in lesson Battleship 5. Custom Print


#1



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


The lesson said I had the correct answer. When it should have told me my answer was incorrect.


The point of this lesson is to print out the board so that each row of the board is printed to its own line. You are supposed to do this by looping through the board and printing each row. However, if you print the board it passes the test. Even though printing the board as a 2d list doesn't print out each row on its own line


board = []

for item in range(5):
    Os = ["O"] * 5
    board.append(Os)
    
def print_board(printboard):
    for row in printboard:
        print row

print board


#2

you should call the function if you want the function to execute which prints each row on its own line


#3

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