promptdojo_

AI tried to update a class-level constant from inside an instance method. The intent was to change the rate for all Account instances. But self.rate = 0.05 doesn't update the class attribute. It creates a new instance attribute that shadows the class one, only on this instance.

The lesson here is the SHADOWING, not the fix. Mutating shared class state from an instance method is rare and usually a design smell. A cleaner version would be a @classmethod or just Account.rate = 0.05 at module level. For this drill, fix line 6 to write to the class so you can SEE the shadowing rule.

Expected output (both accounts share the new rate):

0.05 0.05
The break is on line 6 — but read the whole snippet first.

this step needs the editor

on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.

open this same url on a laptop to keep going today.