Duck Typing Fundamentals

Easy Polymorphism & Duck Typing
Solve in Playground →

Problem Statement

Create a `Duck` class that prints ‘Quack!’ in its `quack()` method. Create a `Person` class that prints ‘I am quacking!’ in its `quack()` method. Create a standalone function `make_it_quack(obj)` that calls `obj.quack()`. Pass an instance of both to the function.

Input Format

None

Output Format

Print the outputs on separate lines.

Constraints

None

Sample Output

Quack!
I am quacking!

Explanation

Duck typing means Python checks for the presence of a method rather than the strict class type of the object ('If it walks like a duck...').

Starter Code

class Duck:
    pass

class Person:
    pass

def make_it_quack(obj):
    # Call quack on the object
    pass

if __name__ == '__main__':
    # Test duck typing here
    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