You can download this code by clicking the button below.
This code is now available for download.
Converts the input text into ASCII art
Technology Stack : Built-in dictionary, string methods
Code Type : Function
Code Difficulty : Intermediate
def ascii_table(text):
ascii_art = {
'a': ' @@@ ',
'b': '@@@@@ ',
'c': ' @@@@ ',
'd': '@@@@@ ',
'e': ' @@@ ',
'f': ' @@@ ',
'g': ' @@@@ ',
'h': '@@@@@ ',
'i': ' @@@ ',
'j': ' @@@ ',
'k': ' @@@@ ',
'l': ' @@@ ',
'm': '@@@@@ ',
'n': '@@@@@ ',
'o': ' @@@@ ',
'p': ' @@@@ ',
'q': ' @@@@ ',
'r': ' @@@ ',
's': ' @@@ ',
't': ' @@@ ',
'u': ' @@@@ ',
'v': '@@@@@ ',
'w': '@@@@@ ',
'x': ' @@@@ ',
'y': ' @@@@ ',
'z': ' @@@@ '
}
def get_ascii_char(char):
return ascii_art.get(char.lower(), ' ')
return ''.join(get_ascii_char(char) for char in text)