2010/7/28 Dave Angel
> ZUXOXUS wrote:
>
>>
>>
>> My doubt now is whether I can change the way python show the combinations.
>>
>> I mean, here's what python actually does:
>>
>>
>>
>>> for prod in itertools.product('abc', repeat=3):
>
>
print(prod)
>>
>> ('a', 'a', 'a')
>> ('a', 'a'
ZUXOXUS wrote:
My doubt now is whether I can change the way python show the combinations.
I mean, here's what python actually does:
for prod in itertools.product('abc', repeat=3):
print(prod)
('a', 'a', 'a')
('a', 'a', 'b')
('a', 'a', 'c')
('a', 'b', 'a')
('a', 'b', 'b')
('a', '
>
> 2010/7/28 Dave Angel
>
>
> Your latest version gets the product of two. But if you want an arbitrary
>> number, instead of repeating the iterable ('ABC' in your case), you can
>> use
>> a repeat count. That's presumably what you were trying to do in your
>> earlier incantation. But you for
ZUXOXUS wrote:
2010/7/28 Dave Angel
Your latest version gets the product of two. But if you want an arbitrary
number, instead of repeating the iterable ('ABC' in your case), you can use
a repeat count. That's presumably what you were trying to do in your
earlier incantation. But you forgot
2010/7/28 Dave Angel
>
>
> ZUXOXUS wrote:
>
>> Oh, I think i got it:
>>
>>
>>
>>> for prod in itertools.product('ABC', 'ABC'):
>
>
print(prod)
>>
>> ('A', 'A')
>> ('A', 'B')
>> ('A', 'C')
>> ('B', 'A')
>> ('B', 'B')
>> ('B', 'C')
>> ('C', 'A')
>> ('C', 'B')
>> ('C', 'C')
>>
>> Thank
ZUXOXUS wrote:
Oh, I think i got it:
for prod in itertools.product('ABC', 'ABC'):
print(prod)
('A', 'A')
('A', 'B')
('A', 'C')
('B', 'A')
('B', 'B')
('B', 'C')
('C', 'A')
('C', 'B')
('C', 'C')
Thank you very much!!
2010/7/28 ZUXOXUS
You're top-posting, which loses all the
Oh, I think i got it:
>>> for prod in itertools.product('ABC', 'ABC'):
print(prod)
('A', 'A')
('A', 'B')
('A', 'C')
('B', 'A')
('B', 'B')
('B', 'C')
('C', 'A')
('C', 'B')
('C', 'C')
Thank you very much!!
2010/7/28 ZUXOXUS
> Mac,
>
> this is what I get:
>
> >>> for prod in itertools.product('A
Mac,
this is what I get:
>>> for prod in itertools.product('ABC', 2):
print(prod)
Traceback (most recent call last):
File "", line 1, in
for prod in itertools.product('ABC', 2):
TypeError: 'int' object is not iterable
hmm, what might be that 'int' object? 2?
2010/7/28 ZUXOXUS
> Shar
Sharp thanks, but:
I try to reproduce the example from the table, but:
>>> import itertools
>>> combinations('ABC', 2)
Traceback (most recent call last):
File "", line 1, in
combinations('ABC', 2)
NameError: name 'combinations' is not defined
>>>
If im not mistaken, it should return AB, A
On Tue, 2010-07-27 at 23:31 +0100, Mark Lawrence wrote:
> On 27/07/2010 23:20, ZUXOXUS wrote:
> > Hi all pythoners
> >
> > I've got a probably easy to answer question.
> >
> > Say I've got a collections of strings, e.g.: 'man', 'bat', 'super', 'ultra'.
> >
> > They are in a list, or in a sequence o
On 27/07/2010 23:20, ZUXOXUS wrote:
Hi all pythoners
I've got a probably easy to answer question.
Say I've got a collections of strings, e.g.: 'man', 'bat', 'super', 'ultra'.
They are in a list, or in a sequence or whatever, say a bag of words
And now I want to know how many couples I can do
On 07/28/2010 01:20 AM, ZUXOXUS wrote:
Hi all pythoners
I've got a probably easy to answer question.
Say I've got a collections of strings, e.g.: 'man', 'bat', 'super',
'ultra'.
They are in a list, or in a sequence or whatever, say a bag of words
And now I want to know how many couples I ca
Hi all pythoners
I've got a probably easy to answer question.
Say I've got a collections of strings, e.g.: 'man', 'bat', 'super', 'ultra'.
They are in a list, or in a sequence or whatever, say a bag of words
And now I want to know how many couples I can do with them, and I want the
program to s
13 matches
Mail list logo