What is polymorphism and duck typing?
Model answer
Polymorphism means different classes can be used through the same interface. Python uses duck typing: if an object has the methods you need (quacks like a duck), you can use it, without a shared base class. It keeps code flexible, and protocols or abstract base classes document expectations.
Learn this topic
Classes and Objects in Python: A Gentle Introduction in the course Python for Beginners: Learn to Code with Real Projects.
Sign in to add your own answer.