Inheriting from Python's Base Exception

Easy Exception Handling in OOP
Solve in Playground →

Problem Statement

Create a `CustomError` class inheriting from `Exception`. Override `__init__` to accept a `message` and call `super().__init__(message)`. Read an integer. If it exceeds 100, raise `CustomError(‘Value too high’)`. Catch and print the exception object directly.

Input Format

A single integer.

Output Format

Print 'OK' or the exception message.

Constraints

None

Sample Input

150

Sample Output

Value too high

Explanation

Calling super().__init__() ensures the base Exception class properly registers your custom message.

Starter Code

class CustomError(Exception):
    # Define __init__ calling super()
    pass

if __name__ == '__main__':
    val = int(input())
    # Write try-except block
    pass

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