You can download this code by clicking the button below.
This code is now available for download.
The function takes a string as input and creates an ASCII table, which includes the ASCII values and characters themselves from the string.
Technology Stack : String, formatted output
Code Type : Function
Code Difficulty :
def ascii_table(string):
"""
Generate a simple ASCII table from a string.
"""
ascii_art = ""
for char in string:
ascii_art += f"{ord(char):4d} -> {char}\n"
return ascii_art