In this article, we have explored the different ways of defining a 2D array in Python. We have explored three approaches:
Creating a List of ArraysCreating a List of ListsCreating 2D array using numpy
Some terminologies in Python:
Array: An array is a collection of homogeneous elements (i.e. belonging to the same data type) that are stored in contiguous memory locations. In Python, there is a module ‘array’ that needs to be imported to declare/use arrays.
List: A list in Python is collection...
Published on February 09, 2021 23:15