Skip to content

Instantly share code, notes, and snippets.

@potat-dev
Created August 26, 2022 20:44
Show Gist options
  • Save potat-dev/280b2bf24c71e70ca3d27f7e311f3273 to your computer and use it in GitHub Desktop.
Save potat-dev/280b2bf24c71e70ca3d27f7e311f3273 to your computer and use it in GitHub Desktop.
def commentify(text, start, end, width=32, fill="="):
content = f' {text} '.center(width - len(start) - len(end) - 2, fill)
return f'{start} {content} {end}'
while True:
text = input('Enter text: ')
if not text:
break
print(commentify(text.upper(), '//', '//', width=42))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment