That Blue Square Thing

AQA Computer Science GCSE

Programming Concepts – Arrays and Records

Arrays are an example of a data structure. They are a way of storing more than one item of data in a single variable.

In Python they are implemented using lists.

NB: Array indexing almost always starts from 0.

PDF iconArray basics

PDF iconPython list methods to know

Records

Records are the other data structure you need to know about. The problem is that these aren't supported directly by Python.

Think about records as the same sort of thing as a record in a database...

PDF iconRecords basics

PDF iconHow to fake Records in Python – **COMPLEX**

Here's a code file you should be able to copy and paste into IDLE to see how records work.

Text file iconCats records example

Two-dimensional arrays

You can get arrays of anything - strings, integers, Booleans, mixed values. Or arrays of arrays.

An array of arrays can be really powerful as a way if organising data. We call arrays of arrays two-dimensional arrays.

PDF icon2-D Arrays

2-D arrays can be tricky. The exam board likes using them in complex questions towards the end of the exam paper. There are good reasons for this.

There are two code files to take a look at. Try to look at the code first before you run it.

Text file iconDogs 2D arrays example

Text file iconTest scores 2D arrays example – complex

If you need somewhere to run code at home, try this online Python IDE.