Tremendously helpful!!!! One question though. How can i pluck a unique item from my exhaustive list of permutations without repeats making sure that each one is used once? Like filling a bag, shaking it, and then picking from the bag and removing that item from the bag so it isn't used again....


-k


On Feb 1, 2005, at 8:58 PM, [EMAIL PROTECTED] wrote:

f you had a randomizeList function and a stutterList function then your top-level function would
look like this:


permutations = permute(['Red', 'Blue', 'Yellow', 'Green'])
permutations = [ randomizeList(list) for list in permutations ]
permutations = [ stutterList(list) for list in permutations ]

In other words you start with the basic permutations, then apply the randomize function to each
permutation, then apply the stutter function.


The randomizeList function should walk through the list, find the right randomize list for that list
element (a dict could help with that - look up the list element and get the randomize list), and
build a new list with the randomized values.


The stutterList function walks through the list building a new list with possibly repeated elements.

HTH,
Kent

_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Reply via email to