I notice there is no error-checking, so my program would have problems with incorrect input
Lack of error checking, eg duck typing is generally approved of and preferred in python. Surely there are good cases to use input checking, but generally duck-typing is preferred.
I suspect this preference in python is mostly due to all the "primitives" actually being first class objects: intint, strstr, boolbool. They all have values, methods, and identities.
Besides, type checking often just gets in the way of your users. Say I use a integer like-like class that is tied to an active record or has other features that make it better to work with in my application,application; a type check is just a barrier to entry that maybe I don't care to hoop-jump for. I use my integer class in place of integers everywhere in my app just fine, without type checking,checking; your code may/would have optimistically run with whatever given object and worked just fine too. Functions that quit just because say an input object dosen'tdoesn't identify as an integer are just plain annoying.
Of course other suttlesubtle and cleaverclever advantages could be leveraged too. A caller could cleverly integrate with your function in rich ways, passing an impersonated integer-compatible object with valuable performance/analytics tracking and/or whatever else might be needed for a proper unit test, or an object that justjust knows that when certain mathmaths is applied, that it should update a progress bar. Whatever odd edge case matters, pythonPython so often has an in"in". The "we're all consenting adults" dogma that dosent sheilddoesn't shield any part of the rumtimeruntime from good (or bad) ideas, lets the analytics engineer harmlessly track the core components, and let'slets the performance engineer substitute in-place code with bootstrapping and wrappers that hold over until something can be rearchitectedre-architected.
If you are to pursue type checking I would at most suggest catching the kind of operational arithmetic error that incompatible types would cause and raise instead a type error, or a specific-to-your-module exception that probably extends typeerrorTypeError, when the input has produced an apparent failure condition.
The value in extending a module specific-specific exception is that it gives any caller a sure way to catch errors only from your module, without giving up valuable semantics or messages.