So I need to create overload function sum() for adding two numbers, one should take integer values and another float. The input will be only 2 integer numbers for both sum() functions.
How can I distinguish between the first sum() function and second sum() function then? The first sum() function is supposed to be for integer parameters and the second is supposed to be for floating-point. But if the last function is always the one getting called for regardless of whether the parameter is integer or floating-point. I tired different casting but no success
I have for example these function, but can not understand how to overload them
def add(a, b):
return a + b
def add(a:float, b:float):
return a + b
I can not use dispatch() , isintance() or any other modules