I have the following 2d array, displaying as a matrix. I wish to be able to specify the index number of a specific element in the 2d array and turn that number RED (or any colour). Can anyone point me in the right direction please?
Code so far:
>>> grid=[[28, 27, 26, 25,24,23,22], [21,20,19, 18, 17, 16, 15], [8, 9, 10, 11, 12, 13, 14], [7, 6, 5, 4, 3, 2, 1]]
>>> for i in grid:
print(i)
Output:
[28, 27, 26, 25, 24, 23, 22]
[21, 20, 19, 18, 17, 16, 15]
[8, 9, 10, 11, 12, 13, 14]
[7, 6, 5, 4, 3, 2, 1]
For example:
print(grid[0][2])
Gives the output:
26
I would like however, grid[0][2] to turn red, when the grid is displayed on the screen again.
To clarify, this is just expected to be output to the console. I am programming in IDLE --> New file. So output to the Python Shell ..I did google and found nothing, so realise this may not be an obvious fix or even a particularly useful thing to do. Still, it's a question .....