below is code that I've written to check whether or not a Sudoku board (referenced here as board) has a solution or not.
Whenever I run the function solve_board, both the board_copy and board variables change. The board variable will match the board_copy variable. I expect board_copy to change, since variables in Python are passed by assignment. Why does board change? It's not passed in to the function so I wouldn't expect the function to impact it.
board_copy = board                
solve_board(board_copy)
def solve_board(board):
    for row in range(9):
        for col in range(9):
            if board[row][col] == 0:
                for num in range(1, 10):
                    if valid_move(row, col, num, board):
                        board[row][col] = num
                        if solve_board(board, "possible"):
                            return True
                        board[row][col] = 0
                return False 
    return True
 
    