mercredi 23 août 2017

Generate a spaced stream of 52 random letters where each letter occurs twice

Well, we can generate random letters using given code snippet.

import random
stream_I = ''
for idx in range(0,10):
    stream_I = stream_I + ' ' + random.choice('abcdefghijklmnopqrstuvwxyz')
print(stream_I)

But I was wondering how to generate lowercase alphabets 52 times given two conditions -

  • They occur randomly.
  • Every lowercase alphabet repeated twice.



Aucun commentaire:

Enregistrer un commentaire