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.

What this concept actually says

  • A list stores an ordered collection of items accessed by position (index)
  • A dictionary stores key-value pairs accessed by name (key), not position
  • Choosing the right data structure — list vs. dictionary — depends on whether you look things up by order or by label

An analogy your child will recognise

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.

Common misconceptions to watch for

  • Dictionaries are always slower than lists — in reality, dictionary lookups are extremely fast because they use a hash table
  • You can only store one type of item in a list — in reality, Python lists can hold any mix of types, though mixing types is often a sign of needing a dictionary instead

Key facts in one breath

  • Python list indices start at 0, so the first item is at index [0]
  • Dictionary keys can be strings, numbers, or tuples — but must be immutable (unchangeable) types
  • Lists are ordered and allow duplicates; dictionaries (from Python 3.7+) are also ordered by insertion
  • The len() function works on both lists and dictionaries to return the number of items

How Dhee Learning teaches this — the 3-stage question loop

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

Related concepts

Want your child to actually understand this?

Dhee turns this concept into a 15-minute spoken session — asking, listening, and probing — so your child builds the idea themselves.

Frequently asked questions

What is lists and dictionaries — explained for kids? +

Lists store items by position; dictionaries store them by name. The two workhorses of Python. For Class 7.

What's the most common mistake children make about this concept? +

Dictionaries are always slower than lists — in reality, dictionary lookups are extremely fast because they use a hash table

How does Dhee Learning teach this in a Class 7 session? +

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.