Convert ASCII to Alphabet Characters

  • Share this:

Code introduction


This function takes two arguments, converts them to lowercase, and then converts the ASCII values to corresponding letters, returning a string composed of these two letters.


Technology Stack : Built-in functions (str.lower(), ord(), int)

Code Type : Function

Code Difficulty : Intermediate


                
                    
def a_to_z(arg1, arg2):
    alphabet = 'abcdefghijklmnopqrstuvwxyz'
    return alphabet[ord(arg1.lower()) - ord('a')] + alphabet[ord(arg2.lower()) - ord('a')]