import numpy as np import os
def set_Matrix (): row = int(input("Enter how many Rows you want : ")) col = int(input("Enter the number of columns : ")) global matrix mx = np.array(['']) one_d = (row * col) - 1 for x in range(0,one_d): mx = np.append( mx, ['']) print(mx) matrix = mx.reshape(row,col)
def place_x(row,col,value): matrix[row,col] = value
def place_o(row,col,value): matrix[row,col] = value
os.system('cls') # Windows command set_Matrix() place_x(3,1,'X') place_o(0,1,'O') print('Matrix : \n',matrix) print("Tic Tac Toe range :", matrix.shape)