Skip to content

Instantly share code, notes, and snippets.

@vampjaz
Created November 24, 2014 15:59
Show Gist options
  • Save vampjaz/a9ca7facaa4fd1a90b80 to your computer and use it in GitHub Desktop.
Save vampjaz/a9ca7facaa4fd1a90b80 to your computer and use it in GitHub Desktop.
Print out large ASCII block letters using python
letters = { "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":[ "###", " #", " #", "#", "###"], " ":[ " "], "1":[ " #", "##", " #", " #", "###"], "2":[ "###", " #", "###", "#", "###"], "3":[ "###", " #", "###", " #", "###"], "4":[ "#", "#", "# #", "###", " #"], "5":[ "###", "#", "###", " #", "###"], "6":[ "###", "#", "###", "# #", "###"], "7":[ "###", " # ", " #", " #", "#"], "8":[ "###", "# #", "###", "# #", "###"], "9":[ "###", "# #", "###", " #", "###"], "0":[ "###", "# #", "# #", "# #", "###"], "!":[ " # ", " # ", " # ", " ", " # "], "?":[ "###", " #", " ##", " ", " # "], ".":[ " ", " ", " ", " ", " # "], "]":[ " ", " ", " ", " #", " # "], "/":[ " #", " #", " # ", "# ", "# "], ":":[ " ", " # ", " ", " # ", " "], "@":[ "###", "# #", "## ", "# ", "###"], "'":[ " # ", " # ", " ", " ", " "], "#":[ " # ", "###", " # ", "###", " # "] }
# letters stolen from here: http://www.stuffaboutcode.com/2013/08/raspberry-pi-minecraft-twitter.html
def print_letters(text):
bigletters = []
for i in text:
bigletters.append(letters.get(i.lower(),letters[' ']))
output = ['']*5
for i in range(5):
for j in bigletters:
temp = ' '
try:
temp = j[i]
except:
pass
temp += ' '*(5-len(temp))
temp = temp.replace(' ',' ')
temp = temp.replace('#','@')
output[i] += temp
return '\n'.join(output)
print print_letters('hello world')
@python4d
Copy link

@tskxz
Copy link

tskxz commented May 18, 2019

The correct command is print (print_letters('hello world'))

@leo848
Copy link

leo848 commented Mar 13, 2020

This is python 3, he used python 2, 2 is now deprecated

@theychx
Copy link

theychx commented Mar 28, 2020

I've tidied this up a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment