Comparing Two Arguments Function

  • Share this:

Code introduction


Defined a function to compare two arguments, returning -1, 0, or 1 respectively, indicating that the first argument is less than, equal to, or greater than the second argument.


Technology Stack : Built-in functions

Code Type : Comparison function

Code Difficulty : Intermediate


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