classes — reading what ai just wrote you9 / 9
class, __init__, self — the three keywords ai uses every time
Checkpoint
One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.
AI handed you the skeleton of a Cart class. The __init__ and add
methods are wired correctly. Your job: finish the total method so it
returns the sum of all prices currently in self.items.
Expected output:
17
⌘↵ runs the editor.
Booting Python…
Output
[promptdojo:~]$ _