Absolute Difference Calculator

  • Share this:

Code introduction


Calculates the absolute difference between two numbers.


Technology Stack : Built-in function abs()

Code Type : Mathematical calculation function

Code Difficulty :


                
                    
def abs_diff(a, b):
    """
    Calculate the absolute difference between two numbers.
    """
    return abs(a - b)