Creating ASCII Table with Text and Character

  • Share this:

Code introduction


Generate an ASCII table with the given text and filled with specified character.


Technology Stack : String manipulation

Code Type : Text formatting

Code Difficulty : Intermediate


                
                    
def ascii_table(text, char='*'):
    def get_row(text, char):
        return char * (len(text) + 2)
    
    print(get_row(text, char))
    print(f"{char}{text}{char}")
    print(get_row(text, char))