Classes, instances, and dataclasses
Which object changes when you set the first book’s pages to 121?
Examples
Worked example
Input
Book("A", 120) and Book("B", 80)Expected output
Only Book A.
Hints and solution
Hint 1
Write down the starting state and walk through one example by hand.
Reveal worked answer
Each instance stores its own pages field. Assigning through the first object leaves the second untouched.