Static Data Structures · 1D and 2D Arrays · List Operations
CSZoneEdexcel GCSE Computer Science 1CP2
Arrays
Fixed-Size Collections
An array is a data structure that stores a fixed number of items of the same data type in contiguous memory. Items are accessed using an index, starting at 0 in most languages.
Array: fixed size, same data type, fast access by index, stored in contiguous memory
Python list: dynamic size, can hold mixed types, supports append/remove/insert
names = []
names.append("Alice") # add to end
names.append("Bob")
names.remove("Alice") # remove item
print(len(names)) # 1
Exam Practice
Have a go at this question
Edexcel-style question
A list called temps stores temperature readings: [14, 22, 19, 31, 27]. Write Python code to output the third temperature and the total number of items in the list.