all possible combinations
Thorsten Kampe
thorsten at thorstenkampe.de
Thu Jul 14 05:17:10 EDT 2005
* Thomas Bartkus (2005-07-13 20:20 +0100)
> "George Sakkis" <gsakkis at rutgers.edu> wrote in message
> news:1121277937.a2a3097d7c150f1b8a3f41a21a9f2b25 at teranews...
>> "rbt" <rbt at athop1.ath.vt.edu> wrote:
>>
>>> Say I have a list that has 3 letters in it:
>>>
>>> ['a', 'b', 'c']
>>>
>>> I want to print all the possible 4 digit combinations of those 3
>>> letters:
>>>
>>> 4^3 = 64
>>
>>
>> It's actually 3^4 = 81 (3 candidates/choice ** 4 choices)
>
> Yes. You get a cigar!
>
> Someone else (Jack Diederich) also mentioned "This is called a cartesian
> product, ..."
> Right again.
In set theory it's called "cartesian product" while in combinatorics
it's called "variation with repetition". There is some "die-hard"
terminology confusion about permutations, combinations and variations
(see [1] for example).
(luckily at least most of the Python "officials" (GvR and Frederik
Lundh) seem to agree about this terminology)
Thorsten
[1] http://groups-beta.google.com/group/comp.lang.python/msg/dea80dec0192eda6?hl=en&
More information about the Python-list
mailing list