I am working on a game project and want to create a board of game by using the NumPy array. So I defined a function board() for that. But when I try to change an element of the board, it doesn't change.
CODE
import numpy as np
def board():
game = np.zeros((6, 6))
return game
board()[1, 1] = 6
print(board()[1, 1]) # Expected Output = 6, Instead it gives 0
I guess there is some problem with local and global variables. I searched for it on this site but didn't find an expected solution. As I know how to change a global variable called inside a function but I don't know how to change a local variable. Any help will be appreciated.