You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
An array (called a list in Python) is a data structure that stores multiple values under a single identifier. Arrays are essential for managing collections of data efficiently and are a key topic in GCSE Computer Science (AQA 3.2 / OCR J277 2.2).
An array is an ordered collection of elements of the same data type, stored in contiguous memory locations. Each element is accessed by its index (position number).
| Index | 0 | 1 | 2 | 3 | 4 |
|---|---|---|---|---|---|
| Value | "Alice" | "Bob" | "Charlie" | "Diana" | "Eve" |
Key Point: In most programming languages (including Python), array indices start at 0. This is called zero-based indexing. In AQA pseudocode, indices also start at 0.
names ← ["Alice", "Bob", "Charlie", "Diana", "Eve"]
scores ← [85, 72, 91, 64, 78]
names = ["Alice", "Bob", "Charlie", "Diana", "Eve"]
scores = [85, 72, 91, 64, 78]
Use the index to read or modify a specific element:
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.