Python related


#1

hii guys , question here
suppose I have defined a function and given my argument and applied for loop inside function:
def print_board(board_in):
for row in board_in:
return row
print_board(board)
tell me bug here


#2

By default, a function returns None at the end of the function. If we want to return something else at the end of the function, we can use the return keyword.

Given return is the last thing a function does, when a return keyword is reached, the function ends

so your function ends in the first iteration of the loop, which can’t be right, given the board contains multiple elements, why would you want to use return here anyway? This is a function which has printing as purpose


#3

thanx for your answer !!