Class 7 · CBSE AI · Strand B — Python for AI
Python lists and dictionaries for beginners — Class 7
Lists store items by position; dictionaries store them by name. The two workhorses of Python. For Class 7.
Class 7 · CBSE AI · Strand B — Python for AI
Lists store items by position; dictionaries store them by name. The two workhorses of Python. For Class 7.
Train compartments
A list is like train compartments numbered S1, S2, S3 — you find a seat by its number. A dictionary is like a hotel where each room has a name ('Deluxe Suite', 'Standard Room') — you find what you want by its label, not its position.
Bazaar inventory
A shopkeeper at a mela keeping stock in boxes numbered 1 to 50 uses a list. A pharmacy with labelled drawers — 'paracetamol', 'bandages', 'eye drops' — uses a dictionary. Choose based on whether you navigate by number or by name.
Every Dhee Learning session for this concept follows three stages. We share the questions Dhee actually asks, so you can hear what a session sounds like.
Stage 1 — Surface
You want to store the names of 30 students in your class in Python. You could use 30 separate variables. Why is that a terrible idea?
Rote answer
"Because a list is easier"
Understood
"Managing 30 separate variables means 30 names to remember, no way to loop through them, and the code breaks if you add a 31st student — a list handles all of these automatically"
Stage 2 — Reasoning
Here are two ways to store a student's data: ['Priya', 14, 88.5, True] versus {'name': 'Priya', 'age': 14, 'score': 88.5, 'passed': True}. When would each be more useful?
Follow-up Dhee may use: What happens if you add a new field to a list of student records vs. a dictionary? Which is safer?
Stage 3 — Application
Build a mini student report card in Python: a dictionary for one student with at least four fields, and a list of three such dictionaries. How would you get the score of the second student?
Misconception Dhee watches for: Confusing list index (starts at 0) with a natural counting order — many beginners write students[2] to get the second student
Dhee turns this concept into a 15-minute spoken session — asking, listening, and probing — so your child builds the idea themselves.
Lists store items by position; dictionaries store them by name. The two workhorses of Python. For Class 7.
Dictionaries are always slower than lists — in reality, dictionary lookups are extremely fast because they use a hash table
Dhee opens with a question — for example: "You want to store the names of 30 students in your class in Python. You could use 30 separate variables. Why is that a terrible idea?" — listens to your child's answer, then probes the reasoning behind it. The session ends when the child can apply the idea to a brand-new situation, not just recall it.