ASCII Code Difference Comparer

  • Share this:

Code introduction


Compares the ASCII code differences of corresponding characters in two strings and returns a list of these differences.


Technology Stack : Built-in functions (ord(), zip(), abs(), list comprehension)

Code Type : Function

Code Difficulty : Intermediate


                
                    
def aordiff(arg1, arg2):
    def ord(a):
        return [ord(c) for c in a]
    
    def diff(a, b):
        return [abs(i - j) for i, j in zip(a, b)]
    
    return diff(ord(arg1), ord(arg2))