Polymorphism means many forms: one method name works across classes, and Python simply asks the object to do its thing.
1 Same Name, Many Shapes
Different classes can define the same method — speak, sound, draw — each in its own way.
2 Duck Typing
Python calls the method if it exists; the class name is never inspected first.
3 Loops Stay Simple
Your loop code never changes when you add a new type to the list.
4 Overriding
Subclasses can replace inherited methods — the child version wins for its objects.
Same call, different answers
Same Name, Many Shapes1Different classes can define the same method — speak, sound, draw — each in its own way. Duck Typing2Python calls the method if it exists; the class name is never inspected first. Loops Stay Simple3Your loop code never changes when you add a new type to the list. Overriding4Subclasses can replace inherited methods — the child version wins for its objects. 4 building blocks make up Same call, different answers
Dog and Robot share nothing — except a method name. The loop cannot tell the difference.
mainclass Dog defines speak — one way to answer the same question.
Memory
no variables yet — press play
Console
output appears as the program runs…
thing is just a reference — whichever object it points at decides how speak() answers.
Drag to orbit the scene. Press Play to watch memory in action.
A parent and an overriding child walk into one loop.
Your predicted output — one line per console line
Hint: Both objects answer .sound(). The Duck overrides the inherited version, so it quacks instead.
Click a term, then click its description to lock the pair.
5 conceptsTap a card to expand ?duck typingdrops into place
?thing.speak()drops into place
?overridedrops into place
?[Dog(), Robot()]drops into place
?for thing in zoodrops into place
01Polymorphism: one call like thing.speak() works across many different classes.
02Duck typing checks for the method, not the class — if it quacks, it counts.
03A list can hold Dog, Robot and Cat objects and loop over them uniformly.
04Overriding lets a subclass answer the same call its own way.
05New types slot into old loops with zero changes to the loop code.