Pseudocode
A record groups related data items under one identifier. The items inside it are called fields, and each field can hold a different type, because a record describes one whole thing — a player, a product, a hospital patient — rather than a list of matching values.
| Field | Type | Example value |
|---|---|---|
| playerName | string | "Nadia" |
| shirtNumber | integer | 11 |
| averageSpeed | real | 7.4 |
Keeping these three values inside one record means the whole record can be stored, moved and printed as a single item, and the fields stay together so they cannot be mixed up with another player's data. To hold a whole team you use an array of records: one element per player, and a FOR loop that visits each element and reads its fields. A record is not a two-dimensional array — its fields may be different types and are reached by name, not by a row and column position.
A string is a one-dimensional sequence of characters, used for any text: a word, a postcode, a password. len() gives the number of characters it holds.
Because a string is a sequence, a FOR loop can process it one character at a time — counting something, checking a code follows a pattern, or building a new string from the pieces. This example counts how many vowels a word contains.
word = input("Enter a word: ")
vowels = 0
for letter in word:
if letter == "a" or letter == "e" or letter == "i" or letter == "o" or letter == "u":
vowels = vowels + 1
print("Vowels: " + str(vowels))Output when the user types pineapple:
Enter a word: pineapple
Vowels: 4
The IF condition compares each character with lowercase vowels only, so a word typed in capitals would score nothing.
Edexcel GCSE Computer Science · Pseudocode
Edexcel GCSE Computer Science · Data Types
Edexcel GCSE Computer Science · Two-dimensional Arrays (2D Lists)