proomt

Search

Search posts, papers, and topics

All posts

Real Python1 min readintro

Quiz: Python's Mutable vs Immutable Types: What's the Difference?

Summary

The page offers a 12‑question interactive quiz that checks knowledge of Python’s mutable vs immutable types, covering built‑in type categories, aliasing pitfalls, mutable default arguments, and shallow copy behavior.

  • Mutable objects can be changed in place; immutable objects cannot.
  • Built‑in mutable types include list, dict, set; immutable types include tuple, str, int.
  • Using a mutable default argument can cause unexpected state sharing across calls.
  • Shallow copies duplicate container structure but not nested mutable objects.
3/10

Related reading

  1. Quiz: Thinking Recursively in Python

    This is an interactive quiz from Real Python designed to test understanding of recursive thinking in Python. It covers identifying recursive structures, writing base and recursive cases, managing state, and using caching to avoid recomputation.

    Real Pythonrealpython.com1 min