Advertisement
MrPinzon

smiley_generator.py

Apr 21st, 2021
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. def create_emoticon_generator():
  2.     while True:
  3.         strings = "!@#^*_-=+/,.;~"
  4.         grouped_strings = [("(", ")"), ("<", ">"), ("[", "]"), ("{", "}")]
  5.         grp = random.choice(grouped_strings)
  6.         face_strings_list = [random.choice(strings) for icon in range(3)]
  7.         face_strings = "".join(face_strings_list)
  8.         emoticon = (grp[0], face_strings, grp[1])
  9.         emoticon = "".join(emoticon)
  10.         yield emoticon
  11.  
  12. g = create_emoticon_generator()
  13. print([next(g) for smiley in range(4)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement