Absolute Difference Calculator

  • Share this:

Code introduction


This function takes two arguments and returns the absolute difference between them.


Technology Stack : Built-in function abs()

Code Type : Mathematical function

Code Difficulty :


                
                    
def aordiff(arg1, arg2):
    """
    计算两个数的绝对值差。

    :param arg1: 第一个数字
    :param arg2: 第二个数字
    :return: 两个数字的绝对值差
    """
    return abs(arg1 - arg2)