Same index, related data
Sometimes one array is not enough. You might store names in one list and marks in another. They stay in lockstep: the student at names[2] has the mark at marks[2].
That pairing is a parallel array. To look something up, use linear search on the key array, then read the other array at the same index.
result = None for i in range(len(names)): if names[i] == target: result = marks[i] break print(result)
Find "Chen" in names, store marks[i], then break and print.
Run the simulation
Both arrays highlight the same index. Linear search walks names; the match unlocks marks[i].
Why parallel arrays matter
One index ties related facts together without a single “record” type.
Same position = same person
names[i] and marks[i] belong together. Never mix indices across the two lists.
Linear search finds the key
Scan the key array (names) until you match the target, then stop — just like ordinary linear search.
Reuse the index
Once you know i, read any parallel array at i — marks, ages, IDs, and so on.