SECTION 31 / 31

Choose keys and values from the question

1 min read
Reuse the Week 6 historical train cards: sourceStation["02201"] returns Kolkata. Leading zeros remain part of the train-number string.
Reuse the Week 6 historical train cards: sourceStation["02201"] returns Kolkata. Leading zeros remain part of the train-number string.
REAL COURSE DATA · KEYS, COUNTS AND CONNECTIONS

Look up a train’s source station

Follow the dictionary as its keys and values change. Predict each lookup or update before revealing the next step.

Ready

CURRENT RECORD / VALUE

Ready to begin

No records have been processed. Start with Next step.

What we remember

Processed
0

Predict the next key, whether it already exists, and the value that will be stored.

Choose a list for ordered occurrences, a count dictionary for grouped frequencies, or an ID dictionary for membership.
Choose a list for ordered occurrences, a count dictionary for grouped frequencies, or an ID dictionary for membership.

A list preserves an ordered sequence and repeated occurrences. A dictionary connects unique keys to current values. Combining them gives customer→bill-ID lists, birthday→student-ID dictionaries, and part-of-speech→ordered position lists. Choose what information later questions need; aggregation can discard details.

Reuse the same original datasets across these tasks. Student IDs and word positions start at 0, bill numbers start at 1, and train numbers are strings such as “02201”. They are different identifiers, not interchangeable list positions. Preserve source records and build derived structures alongside them.

Try it yourself

Which structure helps repeatedly ask “is this ID in the group”?

Show explained answer

An ID-keyed dictionary using isKey, under the course’s dictionary-operation model.

Try it yourself

Which structure retains the sequence and repeated copies of bill-row events?

Show explained answer

A list of those events or references.

Try it yourself

Why preserve train number “02201” as a string?

Show explained answer

Its leading zeros are part of the identifier. Converting to a number would change its displayed identity.

YOUR STUDY PROGRESS

Finished this section? Save your progress.

Back to top ↑