Polymorphism: Same interface, different types

Easy Polymorphism & Duck Typing
Solve in Playground →

Problem Statement

Create two classes: `Car` and `Boat`. Both should have a `move()` method. For `Car`, print ‘Driving on road’. For `Boat`, print ‘Sailing on water’. Instantiate both and call their `move()` methods.

Input Format

None

Output Format

Print the movement strings on separate lines.

Constraints

None

Sample Output

Driving on road
Sailing on water

Explanation

Polymorphism allows different object types to share the same method signature while implementing unique behaviors.

Starter Code

class Car:
    # Define move method
    pass

class Boat:
    # Define move method
    pass

if __name__ == '__main__':
    # Instantiate and call move() for both
    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