Ready to begin
No records have been processed. Start with Next step.

Follow the dictionary as its keys and values change. Predict each lookup or update before revealing the next step.
Ready
No records have been processed. Start with Next step.
Predict the next key, whether it already exists, and the value that will be stored.
Now use CityTown as the key and a student count as the value. Each record increments exactly one city. This is the same create-or-increment pattern as word lengths; only the chosen key changes. You no longer need separate counters named ChennaiCount, MaduraiCount and so on.
cityCount = {}
foreach X in scores {
city = X.CityTown
if (not isKey(cityCount,city)) {
cityCount[city] = 0
}
cityCount[city] = cityCount[city] + 1
}Use consistent labels. “Bengaluru” is the dataset label; the spoken lecture sometimes says Bangalore. A deliberate alias map can combine known alternatives. Do not automatically merge unrelated places just because their names look similar.
What do city keys represent?
The distinct CityTown labels observed in the input.
Why is setting a new city to 0 followed by adding 1 correct?
The first record becomes 1; later records increment the accumulated value.
Does reversing the cards change city totals?
No. It may change intermediate states, but each student still contributes once to the same city.