Question #165541

Write a program to print the absolute difference between the two given numbers. (Absolute difference is the difference without the negative sign)


Expert's answer

#function to return the Absolute difference
def absDiff(a,b):
    return abs(a)-abs(b)

#test runs    
print(absDiff(-1,3)) #-2
print(absDiff(-1,-3)) #-2
print(absDiff(1,3)) #-2
print(absDiff(-5,3)) #2

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS