What is `abc.ABC` and `@abstractmethod` used for in Python?

Python Hard
Select the correct answer: Single Choice

Key points

  • abc.ABC enables abstract base classes
  • @abstractmethod marks methods that must be implemented
  • Instantiating a class with unimplemented abstract methods raises TypeError
  • Ensures interface contracts are enforced

Ready to go further?