#!./venv/bin/python import names import random import shutil # pretty formatting! titleformat = '\x1b[3;31m' storyformat = '\x1b[1;0;41m' reset = '\x1b[0m' # get terminal size to make the output centered termsize = shutil.get_terminal_size((80, 20)) # create a random amount of stories between 1 and 6 stories = f'{storyformat}[ name ]{reset} ' * random.randint(1, 6) # replace each placeholder name with a random first or full name for _ in range(stories.count('name')): stories = stories.replace('name', random.choice( [names.get_full_name(), names.get_first_name()]), 1 ) # output the unholy text print(f'{titleformat}New stories:{reset}'.center(termsize.columns)) print(stories.center(termsize.columns) + '\n')