Quiz Catalog

Catalog of quizzes

class A:
  def __init__(self, i):
  self.i = i

  def __eq__(self, __o: object) -> bool:
    return self.i == __o.i

a1 = A(1)
a2 = A(2)
a3 = A(2)

values = [a1, a2, a3]

print(values.count(a2))
2
  • class/method/__eq__