Custom Print


#1


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

I was just wondering why the code works with only print and not return


def print_board(board):
    for row in board:
        print row
    
print_board(board)



----------

def print_board(board):
    for row in board:
        return row
    
print_board(board)

why do I get an error while using return?


#2

Hi @digitalsurfer96512,

The instructions include ...

Inside the function, write a for loop to iterates through each row in board and print it to the screen.

Although you can write the function to return the result, it is contrary to that instruction, which stipulates that the function print it instead.


#3

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