Comparing Two Arguments Function

  • Share this:

Code introduction


This function compares the two arguments and returns 1 if the first argument is greater than the second, -1 if the first argument is less than the second, and 0 if both arguments are equal.


Technology Stack : Comparison operations

Code Type : Comparison function

Code Difficulty :


                
                    
def aordiff(arg1, arg2):
    if arg1 > arg2:
        return 1
    elif arg1 < arg2:
        return -1
    else:
        return 0