Created
September 2, 2014 20:18
-
-
Save JanneSalokoski/6ecd4db2889ca88f3e2d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def start(self, name): | |
length = len(name) | |
wordLength = length | |
print("\n") | |
if length > 20: | |
length = length + 2 | |
print("|", end="") | |
for i in range(0, length): | |
print("-", end="") | |
print("|") | |
print("| " + name + " |") | |
print("|", end="") | |
for i in range(0, length): | |
print("-", end="") | |
print("|\n") | |
else: | |
space = int((20 - wordLength) / 2) | |
if int((20 - wordLength) % 2) == 0: | |
print("|--------------------|\n|", end="") | |
for i in range(0, space): | |
print(" ", end="") | |
print(name, end="") | |
for i in range(0, space): | |
print(" ", end="") | |
print("|\n|--------------------|\n") | |
else: | |
print("|--------------------|\n|", end="") | |
for i in range(0, space): | |
print(" ", end="") | |
print(" " + name, end="") | |
for i in range(0, space): | |
print(" ", end="") | |
print("|\n|--------------------|\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment