Notes · Class 11 · CBSE · Science Computer Science
Tuples and Dictionaries notes
Revision notes for the chapter: the key points, definitions and exam tips to remember.
Tuples are immutable sequences; dictionaries store key–value pairs.
TUPLES
- T = (1, 2, 3); single item needs a comma: (5,).
- Indexing, slicing, concatenation, repetition, membership.
- Immutable: can't change items (but a list inside a tuple can change).
- Methods: len(), count(), index(), sorted(), min(), max(), sum().
- Tuple assignment: (a, b) = (b, a) swaps values.
- Faster than lists; used for fixed data.
DICTIONARIES
- D = {"name": "Asha", "age": 15}. Keys must be unique and immutable.
- Access: D["name"] or D.get("name").
- Add/modify: D["class"] = 11.
- Mutable; unordered in concept (insertion order is kept since Python 3.7).
- Methods: keys(), values(), items(), get(), update(), del, pop(), clear(), fromkeys(), copy().
- Traverse: for k in D: print(k, D[k]).
COMMON PROGRAMS
- Count frequency of characters/words using a dictionary.
Memory hook: "Tuple = locked list; dict = labelled boxes."
Tuples and Dictionaries: practice questionsTuples and Dictionaries cheat sheet
More Class 11 · CBSE · Science Computer Science notes
Practise Tuples and Dictionaries
Sign up free to practise the full chapter after revising. Questions you get wrong come back until you've mastered them.
Start practising freeFree to start · No credit card needed