Knowledge organisersAdditional Programming Techniques
Use of 2D arrays to emulate database tables of a collection of fields, and records
A record is a data structure used to group related data of different types under one structure, similar to a row in a database table. Each piece of data in a record is called a field, and fields can have different data types (e.g. string, integer, Boolean). In Python, records can be represented using dictionaries or classes.
# A record as a dictionary
student = {
"name": "Alice",
"age": 16,
"enrolled": True
}
print(student["name"]) # Output: Alice
print(student["age"]) # Output: 16