Spot the bug in the cents parser

from Variables and data types
Python 3.14 intermediate 5 min 2 issues to find

Find why this helper accepts values outside its integer-cents contract.

Python
def record_cents(record: dict[str, object]) -> int:
    cents = record.get("cents") or 0
    if not isinstance(cents, int):
        raise ValueError("cents must be an integer")
    return cents
Open in playground
Report an error