Skip to content

Instantly share code, notes, and snippets.

@luckydonald
Last active October 19, 2018 19:24
Show Gist options
  • Save luckydonald/7d60fd94a7f45b4ef1ebd8241c6672ff to your computer and use it in GitHub Desktop.
Save luckydonald/7d60fd94a7f45b4ef1ebd8241c6672ff to your computer and use it in GitHub Desktop.
def num(n):
string = ["", "", ""]
for d in str(int(n)):
for i, l in enumerate(digit(int(d)).split("\n")):
string[i] += l
# end for
# end for
return "\n".join(string)
# end def
def digit(n):
string = " "
string += "." if n in (1,4) else "_"
string += " \n"
string += "'" if n in (1,2,3,7) else "|"
string += "." if n in (0,1,7) else "_"
string += "'" if n in (5,6) else "|"
string += "\n"
string += "|" if n in (0,2,6,8) else "'"
string += "." if n in (1,4,7) else "_"
string += "'" if n in (2,) else "|"
return string
# end def
for i in range(0,101):
print(num(i), i)
# end for
def num(n, width=1, height=1):
string = [""] * (height + height + 3)
for d in str(int(n)):
for i, l in enumerate(digit(int(d), width, height).split("\n")):
string[i] += l
# end for
# end for
return "\n".join(string)
# end def
def digit(n, width=1, height=1):
string = " " + (("." if n in (1,4) else "_") * width) + " \n"
string += (("'" if n in (1,2,3,7) else "|") + (" " * width) + ("'" if n in (5,6) else "|") + "\n") * (height-1)
string += ("'" if n in (1,2,3,7) else "|") + (("." if n in (0, 1, 7) else "_") * width) + ("'" if n in (5,6) else "|") + "\n"
string += (("|" if n in (0,2,6,8) else "'") + (" " * width) + ("'" if n in (2,) else "|") + "\n") * (height-1)
string += ("|" if n in (0,2,6,8) else "'") + (("." if n in (1,4,7) else "_") * width) + ("'" if n in (2,) else "|") + "\n"
return string
# end def
for i in range(0,101):
print(num(i, width=3, height=2), i)
# end for
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment