Answer:
def difference(num1, num2):
if num1 > num2:
return num1 - num2
else:
return num2 - num1
Step-by-step explanation:
Here's a Python function that calculates the absolute difference between two numbers without using the built-in abs() function:
def difference(num1, num2):
if num1 > num2:
return num1 - num2
else:
return num2 - num1
This function checks which number is larger, and then subtracts the smaller number from the larger number to get the absolute difference. Note that if the two numbers are equal, the function will return 0.