Advertisement
Guest User

catyre's code

a guest
Jul 1st, 2022
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. from random import sample
  2.  
  3. alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  4. stream = []
  5. prev_chars = ["", "", ""]
  6. for _ in range(10):
  7.     chars = sample(alphabet, 3)
  8.  
  9.     for boolean in (c1 == c2 for c1, c2 in zip(chars, prev_chars)):
  10.         if boolean:
  11.             print(f"Repeated letters {(chars, prev_chars)}.  Resampling...")
  12.             #chars = sample(alphabet, 3)
  13.             break
  14.  
  15.     prev_chars = chars
  16.     stream.append(chars)
  17. print(stream)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement