132.2 Arrays
Learn how arrays store fixed-size collections of data and how they differ from Python lists
What is an array?
Declaring a fixed-type array (using array module)
array module)DECLARE grid AS ARRAY OF ARRAY OF INTEGER
SET grid TO [[1, 2], [3, 4]]
OUTPUT grid[1][0]grid = [[1, 2], [3, 4]]
print(grid[1][0]) # Outputs 3Accessing and modifying array elements
DECLARE grid AS ARRAY OF ARRAY OF INTEGER
SET grid TO [[1, 2], [3, 4]]
OUTPUT grid[1][0]grid = [[1, 2], [3, 4]]
print(grid[1][0]) # Outputs 3Fixed size and type
Looping through an array
Multidimensional arrays
Why use an array in Python instead of a list?
Summary: list vs array
Conclusion
Key concepts
Last updated
Was this helpful?