Python, Programming, Data Science, Artificial Intelligence, Data.
duck.fly() # Output: Duck is flying. duck.swim() # Output: Duck is swimming. airplane.fly() # Output: Airplane is flying. # airplane.swim() # Raises AttributeError: 'Airplane' object has no attribute 'swim' In this example, we define two interfaces Flyable and Swimmable using abstract base classes.