Q:

what is a 2 dimensional array

# In python, one dimensional array look like this:

array = ['plain', ' and ', 'boring!']

# and I'd call an index of that one dimensiona list like this:

print(array[2])

>> boring!

# "Okay, nice, but what is a 2D array?" I hear you ask...
# Well, a 2D array would look like this:

array = (['wow, ', 'that is ', 'so ']
         ['cool', ' it has ', 'two rows!'])

# The 2D array has two rows instead of one.
# You can call its index like this:

print(array[1][2]) # [1] is the index of the second row and [2] is the index
# for 'two rows!'

>> two rows!

# And a 3D array would look like this:

array = ([1, 2, 3]
         [4, 5, 6]
         [7, 8, 9])
2

New to Communities?

Join the community