I am trying to learn Python 2D arrays and I am trying to add to an empty one but am getting the error list indices must be integers or slices, not tuple
I wrote what I wanted to do in Java and am trying to translate it over to Python
My Java code:
Object[][] memoryArray = new Object[256][17];
int memoryRow, memoryCol;
int MBR = 12;
int addr = MBR;
memoryRow = addr / 16;
memoryCol = addr % 16 + 1;
memoryArray[memoryRow][memoryCol] = " "+Integer.toString(MBR);
for (Object element: memoryArray) {
System.out.println(element);
}
My Python Code:
memArray = [[None], [None]]
MBR = 55
address = MBR
memR = (address / 16)
memC = (address % 16 + 1)
memArray[[memR], [memC]] = " " + str(MBR)
If anyone could lead me to any pointers on how I should correctly implement this logic in Python? I am not sure what the error is trying to indicate.
I also was wondering if I would be better off using Numpy Arrays?