Why python is duck type ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why python is duck type ?

can any one explain with examples.

7th May 2017, 10:35 AM
Sriram Chowdary Mellamputi
Sriram Chowdary Mellamputi - avatar
3 Answers
+ 4
https://en.m.wikipedia.org/wiki/Duck_typing Python is duck typing because it handle dynamic type variables, meaning that a variable can store any data type ( int, string, ... ) at any time: myVar = 42 print(type(myVar)) myVar = "forty two" print(type(myVar)) With others language with strong typing, you need to declare the type of a variable, and you cannot change the type stored in it at runtime ^^
7th May 2017, 6:19 PM
visph
visph - avatar
+ 2
duck type ?
7th May 2017, 12:28 PM
Sriram Chowdary Mellamputi
Sriram Chowdary Mellamputi - avatar
0
Duck?
7th May 2017, 11:59 AM
Sean Layance
Sean Layance - avatar