Thanks to all who were helpful... some of you guys are too harsh and cynical. Here's what I came up with. I believe it's a proper combination, but I'm sure someone will point out that I'm wrong ;)
groups = [list('abc'),list('abc'),list('abc'),list('abc')] already = [] while 1: LIST = [] for g in groups: sample = random.sample(g, 1) LIST.append(sample[0]) STRING = ''.join(LIST) if STRING not in already: print STRING already.append(STRING) if len(already) == 81: break On Thu, 2005-07-14 at 23:18 +1000, John Machin wrote: > Steven D'Aprano wrote: > > On Thu, 14 Jul 2005 08:49:05 +1000, John Machin wrote: > > > > > >>"You keep using that word. I do not think it means what you think it means." > >> > >>Both of you please google("define: combination") > > > > > > Combination: "a coordinated sequence of chess moves". > > > > "An option position that is effected by either a purchase of two long > > positions or two short positions. The investor purchases a call and a put > > (or sells a call and a put) with different expiration dates and/or > > different strike prices." > > > > Or perhaps "in Scheme, a function call, consisting of a function name and > > arguments written within parentheses." > > > > Yes, mathematically the definition of combination includes that order does > > not matter. But that certainly isn't the case in common English. Now, > > John, given the tone of the posts you are complaining about, > > Wrong -- no complaint. Another quote: "It's a joke, Joyce!" > > > do you think > > I was using combination in the precise mathematical sense, or the common > > English sense? > > As in "Please don't get your combinations in a twist?"? > > > > > (Hint: the very first definition Google finds is "a collection of things > > that have been combined; an assemblage of separate parts or qualities ". > > Not a word there about order mattering or not.) > -- http://mail.python.org/mailman/listinfo/python-list