Sorting Word Characters by ASCII Order

  • Share this:

Code introduction


Sorts the characters of a given word based on the ASCII order of the characters.


Technology Stack : Built-in functions (ord(), sorted())

Code Type : Sort function

Code Difficulty :


                
                    
def aordiff(word):
    def get_order(char):
        return ord(char)

    return sorted(word, key=get_order)