This script allows the user to type as many strings as they want and then prints them nicely in a box centered.
import math i = 0 Text = [] def printspaces(spacenum): for i in range(0, spacenum): print(" ", end="") def printListWithOutline(Text): maxLen = 0 for i in range(0, len(Text)): if len(Text[i]) > maxLen: maxLen = len(Text[i]) print("╔", end="") for i in range(0, maxLen + 2): print("═", end="") print("╗") for i in range(0, len(Text)): print("║", end="") printspaces(math.floor(((maxLen + 2) / 2) - (len(Text[i])) / 2)) print(Text[i], end="") printspaces(math.ceil(((maxLen + 2) / 2) - (len(Text[i])) / 2)) print("║", ) print("╚", end="") for i in range(0, maxLen + 2): print("═", end="") print("╝") while i >= 0: ans = input('{}{}: '.format("line ", i)) if ans == "": i = -1 else: Text.append(ans) i += 1 # find max length printListWithOutline(Text)