Preventing Base Class Instantiation

Medium Abstraction & Interfaces
Solve in Playground →

Problem Statement

A developer forgot to inherit from `abc.ABC` but threw a `NotImplementedError` in the base method to emulate an abstract class. Show this alternate pattern: Create `BaseWorker` with `work(self)` that raises `NotImplementedError`. Subclass it with `Coder` and print ‘Coding…’.

Input Format

None

Output Format

Print the implementation output.

Constraints

None

Sample Output

Coding...

Explanation

Before the 'abc' module, raising NotImplementedError was the standard pythonic way to enforce method implementation in subclasses.

Starter Code

class BaseWorker:
    def work(self):
        # Raise error here
        pass

class Coder(BaseWorker):
    # Implement work
    pass

if __name__ == '__main__':
    c = Coder()
    c.work()

Limits

  • Time Limit: 1s
  • Memory Limit: 256MB

Embedded C Programming

Updated: March 15, 2026
Intermediate

Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used