Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from io import StringIO
from random import gauss,randrange
max_chars=63206 #https://sproutsocial.com/insights/social-media-character-counter/
wrong="9"
right="6"
f=StringIO()
print("""
Encontre o seis para ter uma ótima semana 😇😇👏👏
""",file=f)
remaining=max_chars-f.tell()
msg_right=f"{wrong*5}\n".encode("utf-8")
remaining_lines=remaining/len(msg_right)
pos_line=int(gauss(remaining_lines/2,remaining_lines/8))
msg_wrong=bytearray(msg_right)
i=randrange(len(msg_wrong))
while True:
if msg_wrong[i]!=ord(wrong):
i=randrange(len(msg_wrong))
continue
msg_wrong[i]=ord(right)
break
for line in range(int(remaining_lines)):
msg=msg_right if line != pos_line else msg_wrong
f.write(msg.decode("utf-8"))
assert(f.tell()<max_chars)
f.seek(0)
print(f.read(),end="")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment