Making Objects Callable (__call__)

Medium Magic Methods & Operator Overloading
Solve in Playground →

Problem Statement

Create a `Multiplier` class initialized with a `factor`. Overload the `__call__` method so the object itself can be invoked like a function `obj(value)` to return `value * factor`. Read a factor and a value, initialize, call the object, and print the result.

Input Format

Two space-separated integers: factor and value.

Output Format

Print the computed result.

Constraints

None

Sample Input

5 10

Sample Output

Result: 50

Explanation

The `__call__` method allows an instance of a class to be called as if it were a standard function, often used for functors or stateful callbacks.

Starter Code

class Multiplier:
    # Define __init__ and __call__
    pass

if __name__ == '__main__':
    f, v = map(int, input().split())
    # Instantiate and call the object
    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