Returning list in python and trying to print it but I get error "TypeError: 'NoneType' object is not iterable"

Viewed 19

I'm making a program to take in a board and return a new board that is changed to a few rules. It uses recursion and when the conditions are met I return that current board. As you can see from the title I'm getting an error when I try to print out the board outside of the function after having it returned.

Here is the relevant part of the code.

def start(board):
    print('in start')

    moves = possibleMoves(board)
    for row in board:
        print(row)


    if len(moves) == 0:
        print(moves)
        print(type(board))
        for row in board:
            print(row)
        return board
    else:
        print(moves)
        for i in moves:
            if str(i).isalpha():
                board = changeCol(board, reversed_alpha_map[i])
            else:
                board = changeRow(board, Os, i)
        start(board)

end = start(Golv)
for row in end:
    print(row)

pastebin to entire code: https://pastebin.com/xjEG0udp

0 Answers
Related