Python has a rich set of built-in types covering numbers, text, collections, and more. Knowing them — and which are mutable vs immutable — is fundamental.
Numeric types
x =
y =
z = +
b =
Note: Python int has arbitrary precision — it never overflows (unlike fixed-size ints in C/Java); 2 ** 1000 just works.
s = "hello" # str — Unicode text (immutable)
data = b"bytes" # bytes — raw binary (immutable)
lst = [1, 2, 3] # list — ordered, MUTABLE, allows duplicates
tup = (1, 2, 3) # tuple — ordered, IMMUTABLE
d = {"a": 1, "b": 2} # dict — key→value, mutable, insertion-ordered
s = {1, 2, 3} # set — unordered, unique elements, mutable
fs = frozenset({1, 2}) # frozenset — immutable set
result = None # NoneType — represents "no value" (like null)
if result is None: # always compare to None with `is`, not ==
...
type(x) # <class 'int'>
isinstance(x, int) # True — the preferred check (handles subclasses)
Immutable: int, float, bool, str, tuple, frozenset, bytes, None
Mutable: list, dict, set, bytearray
This distinction matters a lot — immutable objects can be dict keys and are safe to share; mutable ones can change unexpectedly if aliased.
The built-in types are the vocabulary of all Python code.
Knowing each one's purpose (list for ordered sequences, dict for key-value, set for uniqueness, tuple for fixed records), the arbitrary-precision integers, and especially the mutable-vs-immutable split (which governs dict keys, aliasing bugs, and what can be safely shared) is foundational.
Choosing the right type for the job — and understanding its mutability — is a core Python skill that affects correctness and performance throughout a program.