“If it walks like a duck, and it quacks like a duck, then it must be a duck.”
The idea behind this principle is that the code itself doesn’t care about whether an object is a duck, rather it only cares about whether it quacks.
Duck typing is a concept related to dynamic typing, where the type or the class of an object is less important than the methods it defines. When you use duck typing, you do not check types at all. Instead, you check for the presence of a given method or attribute.
In programming, this means that you don’t need to check the actual type of an object, but instead, you just check if it behaves like what you expect it to behave (has the methods you need). If an object can perform the necessary actions, you treat it as though it is of the correct type, regardless of its actual type.