Learn about Python Absolute Difference Between two numbers in the below code example. Also, refer to the comments in the code snippet to get a detailed view about what’s actually happening.
Python Absolute Difference Between two numbers
# Python program to find difference between two numbers # first number num1 = 25 # second number num2 = 13 # num1 is greater than num2 if num1 > num2: diff = num1 - num2 # num1 is less than num2 else: diff = num2 - num1 # print difference value print('The difference between numbers =', diff)
The difference between numbers = 3
Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.
Similar Code : Python Difference Between Two Numbers