• Help

Question related to mission The Most Numbers

 

Why result fail?

My code:

def checkio(*args): print ("args: ", args)

if len(args) == 0:
    print ("empty")
    result = 0
elif len(args) == 1:
    print ("one element")
    result = args[0]
else:
    maximum = max(args)
    minimum = min(args)    
    print ("maximum: ", maximum, ' minimum: ', minimum)
    result = abs(maximum - minimum)

print ("result: ", result)    
return result

Result

args: (1, 2, 3)

maximum: 3 minimum: 1

result: 2

args: (5, -5)

maximum: 5 minimum: -5

result: 10

args: (10.2, -2.2, 0, 1.1, 0.5)

maximum: 10.2 minimum: -2.2

result: 12.399999999999999

args: ()

empty

result: 0

CheckResult

Your result: -0.07

Right result: 0

Fail: checkio(-0.07)