Duck Typing

Mon 10 August 2026
class Car:
    def move(self):
        print("Car moving")

class Boat:
    def move(self):
        print("Boat sailing")

def start(vehicle):
    vehicle.move()

start(Car())
start(Boat())
Car moving
Boat sailing


Score: 10

Category: chapter4_polymorphism