Skip to content

Instantly share code, notes, and snippets.

@mbasaglia
Created March 23, 2018 09:49
Show Gist options
  • Save mbasaglia/3d31a04816979e2c6ef907660a212a7c to your computer and use it in GitHub Desktop.
Save mbasaglia/3d31a04816979e2c6ef907660a212a7c to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
import math
word = sys.argv[1] if len(sys.argv) > 1 else "loss"
rlen = 3 + len(word)
spacing = " " * int(math.floor(rlen / 3))
for letter in word:
print(" %(l)s |%(s)s%(l)s%(s)s%(l)s" % {"l": letter, "s": spacing})
print("-" * 7 + "+" + "-" * rlen)
mid = int(math.ceil(len(word) / 2))
for i, letter in enumerate(word):
print(" %(l)s | %(l)s %(w)s" % {"l": letter, "w": word if i == mid else ""})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment