Created
March 23, 2018 09:49
-
-
Save mbasaglia/3d31a04816979e2c6ef907660a212a7c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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