ASCII Value Dictionary Generator

  • Share this:

Code introduction


The function accepts a string argument and returns a dictionary containing each character in the string and its corresponding ASCII value.


Technology Stack : Built-in function `ord()`, dictionary comprehension

Code Type : Function

Code Difficulty : Intermediate


                
                    
def ascii_table(string):
    ascii_values = {ord(char): char for char in string}
    return ascii_values