I am confused. I have included two codes, the first one gives the desired result (i.e., 5 separate lists of "O").
But in the second code when i replace "print item" with "return item", it doesn't work and gives only one row of "O"
i believe return statement stores the values in the function and print should not have any impact to the function other than just printing out. Therefore i dont understand why using return statement messes up the code and give only one row. can you please clear my mind in this. looks like i got lost
board =  for i in range(0,5): board.append(["O"] * 5) def print_board(board): for item in board: print item print print_board(board) board =  for i in range(0,5): board.append(["O"] * 5) def print_board(board): for item in board: return item print print_board(board)