What are 2D grids? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What are 2D grids?

12th Feb 2016, 2:45 AM
Obadina Tobiloba
Obadina Tobiloba - avatar
2 Answers
+ 1
Do you mean M = [[0,1,2], [3,4,5], [6,7,8]]? M is a list with 3 entries, each of which is a list of 3 entries. M[1][1] is 4. So M acts like a 2D grid, or a 3x3 matrix.
20th Feb 2016, 11:21 AM
Max Robinson
Max Robinson - avatar
+ 1
imagine you need to draw a point in t screen. for that you need coordinates, such as values for X horizontal axis and Y vertical axis. to draw only one point you will need only 2 values, or a single list. But if you need several points with different coordinates you cant represent them with just a single list. So there you make a loat inside a list, one for each axis. this way you represent a 2D grid
22nd Jul 2016, 2:47 PM
Igor Busquets
Igor Busquets - avatar