Handling super() across Multiple Inheritance

Medium Advanced Inheritance & MRO
Solve in Playground →

Problem Statement

Create `Person` with `__init__(self, name)` and `Employee` with `__init__(self, salary)`. Create `Worker(Person, Employee)` that takes `name` and `salary`. To bypass `super()` keyword complexity, explicitly call `Person.__init__(self, name)` and `Employee.__init__(self, salary)` inside `Worker.__init__`. Print ‘Name: [name], Salary: [salary]’.

Input Format

A name and an integer salary separated by space.

Output Format

Print the formatted details.

Constraints

None

Sample Input

Alice 5000

Sample Output

Name: Alice, Salary: 5000

Explanation

When dealing with multiple parent classes that don't cooperatively support `super()`, explicitly calling the parent's `__init__` method and passing `self` is a reliable bypass strategy.

Starter Code

class Person:
    def __init__(self, name):
        self.name = name

class Employee:
    def __init__(self, salary):
        self.salary = salary

class Worker(Person, Employee):
    def __init__(self, name, salary):
        # Explicitly call Person.__init__ and Employee.__init__
        pass

if __name__ == '__main__':
    name, sal = input().split()
    # Instantiate Worker and print details
    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