Quiz Catalog

Catalog of quizzes

class Test:

  def __init__(self, number):
    self.number = number

  def __divmod__(self, other):
    return self.number % other

a = Test(10)
b = Test(3)
print(divmod(a, b))
TypeError: unsupported operand type(s) for %: 'int' and 'Test'
  • class/method/divmod