tubeshowcase●1,194,391 videosβ™‘ My collection 0
← Learn to Code

Learn to Code05:02

Python duck typing πŸ¦†

Bro Code β†—

From the creator

Python duck typing tutorial example explained #python #duck #typing # duck typing = concept where the class of an object is less important than the methods/attributes # class type is not checked if minimum methods/attributes are present # β€œIf it walks like a duck, and it quacks like a duck, then it must be a duck.” class Duck: def walk(self): print("This duck is walking") def talk(self): print("This duck is qwuacking") class Chicken: def walk(self): print("This chicken is walking") def talk(self): print("This chicken is clucking") class Person(): def catch(self, duck): duck.walk() duck.talk() print("You caught the critter!") duck = Duck() chicken = Chicken() person = Person() person.catch(chicken) Bro Code merch store πŸ‘Ÿ : =========================================================== https://teespring.com/stores/bro-code-5 =========================================================== music credits 🎼 : =========================================================== Up In My Jam (All Of A Sudden) by - Kubbi https://soundcloud.com/kubbi Creative Commons β€” Attribution-ShareAlike 3.0 Unportedβ€” CC BY-SA 3.0 Free Download / Stream: http://bit.ly/2JnDfCE Music promoted by Audio Library https://youtu.be/tDexBj46oNI ===========================================================

Published 2021-01-04 Β· Watch on YouTube β†—
Availability and playback restrictions are controlled by the original channel.

Keep exploring Learn to Code