Hello there! I’m an experienced coder who’s just getting into Python for the first time. I know several versions of BASIC, Pascal, C, C++, C#, PHP, MySQL… and so on. Here’s what I have:
1 2 3 4 5 6 7 8
A X X X X X X X X
B X X X X X T X X
C X X X X X X X X
D X X X X X X X X
E X X X X X X X X
F X X X X X X X X
G X X X X X X X X
H X X X X X X X X
This is a simple two-dimensional array. Row 2 Column 6 is “T”. Doing this in C# or VB is easy. In Python? I’m having trouble.
I created my variable:
ball = [[0]*9]*9
… but ball[2][6] = 2 seems to assign the value to the entire column, which I don’t want. I know that what I’m trying to do is possible, and it’s probably pretty straightforward, but I’m missing something fundamental here.
Can you please direct me to the proper method of creating the variable, and changing one single element? Thanks!