why does the function min() gives output -1 if i give arguments as( -1,0,-1.0)?
what did you expect instead then?
lets assume this function has a very basic algorithm implemented:
def my_min(*args): smallest = args for arg in args: if arg < smallest: smallest = arg return smallest print my_min(-1.0,0,-1) print min(-1.0,0,-1)
my function seems reasonable accurate, if we put
-1.0 first, this is the output for both
-1 are equal, so it fails the
arg < smallest condition
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.