Skip to content
JobNetWork
← All Prep Trek tracks

Python, in 10 cards

No chapters to read. Each card gives you the one-line answer, a picture, a quick try-it and the trap interviewers hope you fall into. About 15 minutes for all ten.

0 of 10 done

Card 1 of 10 · Data types

What is the difference between mutable and immutable types?

Say this first

Mutable objects can change in place (list, dict, set). Immutable ones cannot (int, str, tuple, frozenset).

Picture it

Mutable

  • • list, dict, set
  • • Changed in place, same object
  • • Cannot be a dict key (not hashable)
  • • Shared references see the change

Try it

Which statement raises a TypeError?

Common trap

Saying a tuple can never change. A tuple holding a list is fixed, but the list inside can still be modified.

Say it like this

Mutable objects change in place, immutable ones create a new object, and only immutable (hashable) objects can be dict keys.

Full Python notes

Want the rest?

The free cards cover the core. The full notes add 14 more cards in the same style, plus a cheat sheet:

  • • Pass by object reference, scope, lambda, map and filter
  • • Dict internals, sorting, strings, iterators and the with statement
  • • Class vs instance attributes, MRO, __str__ vs __repr__, method types
  • • Memory management and the dict and Counter coding patterns
Get Python PrepTrek on Topmate →

A prep aid, not a guarantee of a job.