Hierarchical Inheritance

Medium Single Inheritance Fundamentals
Solve in Playground →

Problem Statement

Define a base class `Animal` with a class attribute `species = ‘Mammal’`. Create two derived classes, `Dog` and `Cat`, that both inherit from `Animal`. Instantiate both and print their species.

Input Format

None

Output Format

Print 'Dog: Mammal' and 'Cat: Mammal' on separate lines.

Constraints

None

Sample Output

Dog: Mammal
Cat: Mammal

Explanation

Multiple classes can inherit from a single base class, sharing its logic and state.

Starter Code

class Animal:
    species = 'Mammal'

# Define Dog and Cat classes here

if __name__ == '__main__':
    # Instantiate both and print species
    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