Cheat sheet · Class 11 · CBSE · Science Computer Science

Tuples and Dictionaries cheat sheet

The whole chapter on one page: key formulas, facts and the points to remember, for quick revision before a test.

CBSE Class 11 · Computer Science

Cheat sheet

Chapter 10Tuples and Dictionaries

Tuple: fixed record. Dictionary: key → value lookup.

1. Tuples

  • Immutable sequences: (1, 2, 3).
  • Single element needs a comma: (5,).
  • Packing/unpacking: a, b = b, a swaps.
  • Methods: count(), index(); functions: len, min, max, sum, sorted.

2. Dictionaries

  • Unordered (insertion-ordered in 3.7+) key: value pairs.
  • Keys must be immutable and unique.
  • d[key] = value adds or updates.

3. Dictionary Methods

MethodDoes
keys(), values(), items()views of keys, values, pairs
get(k, default)value or default (no error)
update(d2)merge another dict
pop(k), popitem(), clear()remove items
del d[k]delete a key
fromkeys(), copy(), setdefault()build / copy / default

Count characters: for ch in s: d[ch] = d.get(ch, 0) + 1

4. Key Points

  • Tuple can be a dict key; list cannot.
  • Membership on a dict checks keys.
  • Tuples are faster than lists.
  • dict() can be built from a list of pairs.

Remember: Tuple immutable | (5,) | dict methods | get() default

Tuples and Dictionaries: questions and notes

More Class 11 · CBSE · Science Computer Science cheat sheets

Practise Tuples and Dictionaries

Sign up free to practise the full chapter. Questions you get wrong come back until you've mastered them.

Start practising free

Free to start · No credit card needed