promptdojo_

class, __init__, self — the three keywords AI uses every time — step 8 of 9

Write a class called Score that:

  • Takes no arguments to its __init__ (besides self).
  • Sets self.points to 0 in __init__.
  • Has a method add(self, n) that increases self.points by n.

Then create one instance, call .add(3) and .add(7), and print the final points.

Expected output:

10

full-screen editor opens — close anytime to keep reading.