Re: all possible combinations
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: all possible combinations

From: Thorsten Kampe <thorsten@thorstenkampe.de>
Date: Thu Jul 14 2005 - 11:17:10 CEST

* Thomas Bartkus (2005-07-13 20:20 +0100)
> "George Sakkis" <gsakkis@rutgers.edu> wrote in message
> news:1121277937.a2a3097d7c150f1b8a3f41a21a9f2b25@teranews...
>> "rbt" <rbt@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&
Received on Thu Sep 29 16:56:52 2005