On 28/11/11 07:57, Charles Becker wrote:
A way to make the code more 'pythonic' and easier to read might be to
replace the conditional
        while len(random_word_list) != len(word_list)
With the following :
        for x in range(len(word_list))

Unfortunately that won't work with the OPs algorithm.
It involves randomly extracting an item from word_list until all items have been chosen, this is likely to require many more iterations than the number of items in the list because the random choice will pick some items more than once.

This is why we are suggesting that a different algorithm be used instead!

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to