Tuples and Dictionaries
Class 11 · Computer Science
4 ideas in Class 11 Computer Science, explained in plain words, with games and quizzes to practise.
Tuple Basics
Part of: Tuples
Tuples group ordered items in round brackets; immutable; indexed, sliced like lists.
Why it matters. Fixed groups safe. Records held.
Formulas
- Tuple index starts at 0 like lists
- Fixed records like dates suit tuples best
Key words
- Tuple
- : Ordered collection that cannot be edited.
- Immutability
- : Unchangeable nature of tuple items.
- Index
- : Position number starting from zero.
- Length
- : Count of items held by the tuple.
Try it in two minutes
- Round brackets?
- Index from zero?
- Fixed kept?
Try at home. Tuple coordinates.
Tuple Ops
Part of: Tuples
Plus joins tuples; times repeats; unpacking splits into names; loops visit members.
Why it matters. Records joined. Names split.
Formulas
- Plus joins tuples and times repeats them
- Unpacking needs exactly as many names as members
Key words
- Concatenation
- : Joining two tuples end to end with plus.
- Repetition
- : Doubling members with the times operator.
- Unpacking
- : Splitting members into named variables.
- Packing
- : Packing values for a quick two-way swap.
- Membership test
- : Checking whether a value sits inside.
Try it in two minutes
- Join tuples?
- Unpack names?
- Loop members?
Try at home. Unpack a date.
Dict Basics
Part of: Dictionaries
Dicts map unique keys to values in braces; key lookup fast; keys unique, values repeat.
Why it matters. Lookups fast. Pairs mapped.
Formulas
- Dict keys stay unique; values may repeat freely
- A phonebook maps each name to exactly one number
Key words
- Dictionary
- : Braced map from unique keys to values.
- Key
- : Unique lookup label of a pair.
- Value
- : Stored data reached through its key.
- Fast lookup
- : Key lookup reaching data without scanning.
Try it in two minutes
- Pair key value?
- Keys unique?
- Look up fast?
Try at home. Map words meanings.
Dict Methods
Part of: Dictionaries
Add pairs by assignment; get fetches safe; update merges; del removes; loops visit keys, values.
Why it matters. Maps edited. Safely fetched.
Formulas
- get(key, default) fetches safely without errors
- Updating with an old key rewrites its value, not a new pair
Key words
- Adding a pair
- : Pair added by assigning a fresh key.
- get
- : Safe fetch returning a default when missing.
- update
- : Merging another map into the current one.
- del
- : Removing a pair through its key.
- Key looping
- : Keys visited one by one by default.
Try it in two minutes
- Add pairs?
- Fetch safely?
- Loop all?
Try at home. Build marks map.
What your child will practise
- Dict Basics: Space Puzzle (Clue Puzzle)
- Dict Basics: Space Quick Fire (Quick Fire)
- Dict Methods: Ocean Puzzle (Clue Puzzle)
- Tuple Basics: Space Quest (Flip and Match)
- Tuple Ops: Candy Quick Fire (Quick Fire)
- Quiz: Dict Basics (8 questions)
- Quiz: Dict Methods (8 questions)
- Quiz: Tuple Basics (8 questions)
- Quiz: Tuple Ops (8 questions)