How do I print each row of the board?



How do I print each row of the board?


Recall that a for loop can take a list like board and the variable becomes the next item in that list every time it loops. So if we write for item in list_name:, item becomes each item in the list called list_name.
Then inside the for loop we simply print that item by doing print item.
With our board, we’d like to print each row, so by filling in those spots in the for loop template, we should get something along the lines of:

def print_function(list_input):
  for item in list_input:
    print item


At the end, be sure to call our new function and pass it the board!

FAQ: Learn Python - Battleship - Custom Print

Is there a way that the function will not print “None” at the end ?


The function is not doing the printing of None, functions return None in case of absence of a return keyword, if you then decide to print the returned result, you indeed get None printed

but without any code we get to see, that is the most logic guess we can do