[Tutor] permutations?
bob gailer
bgailer at gmail.com
Thu Dec 2 00:12:03 CET 2010
On 12/1/2010 5:45 PM, Alex Hall wrote:
> Hi all,
> I am wondering if there is a python package that will find
> permutations? For example, if I have (1, 2, 3), the possibilities I
> want are:
> 12
> 13
> 23
> 123
> 132
> 231
>
> Order does not matter; 21 is the same as 12, but no numbers can
> repeat. If no package exists, does someone have a hint as to how to
> get a function to do this? The one I have right now will not find 132
> or 231, nor will it find 13. TIA.
According to Wikipedia " there are six permutations of the set {1,2,3},
namely [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1]."
Above you show some "combinations" and a subset of the permutations.
What rules did you apply to come up with your result?
--
Bob Gailer
919-636-4239
Chapel Hill NC
More information about the Tutor
mailing list