Skip to content

Instantly share code, notes, and snippets.

@joshbduncan
Created January 23, 2021 06:36
Show Gist options
  • Save joshbduncan/f2b7a817b1a3b1e45a131a4fc27d8754 to your computer and use it in GitHub Desktop.
Save joshbduncan/f2b7a817b1a3b1e45a131a4fc27d8754 to your computer and use it in GitHub Desktop.
def make_banner(txt: str, padding: int = 5, border: str = '*') -> str:
return (
f'{border * (len(txt) + padding * 2)}\n'
f'{" " * padding}{txt}\n'
f'{border * (len(txt) + padding * 2)}'
)
banner = make_banner('Banner as a variable', 4, '#')
print(banner)
print(make_banner('Print me now! :)', 4, '#'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment