fork download
  1. import random
  2.  
  3. def pieces():
  4. while True:
  5. bag = ['I', 'O', 'T', 'S', 'Z', 'J', 'L']
  6. random.shuffle(bag)
  7. while bag:
  8. yield bag.pop()
  9.  
  10. gen = pieces()
  11.  
  12. print ', '.join(gen.next() for _ in xrange(21))
Success #stdin #stdout 0.01s 10040KB
stdin
Standard input is empty
stdout
S, Z, T, O, L, J, I, O, J, T, Z, S, L, I, L, Z, T, S, O, J, I