Hi,
I am a true beginner in programming, and im learning with
inventwithpython.com.
There's something I dont understand, and i would really appreciate any help.
In chapter 9, the one about the Hangman game, I don't get the block of code
in line 61
59. words = 'ant baboon badger bat bear'
60.
an, I have been checking your tutorial too, great job.
2010/7/13 ZUXOXUS
> Hi,
>
> I am a true beginner in programming, and im learning with
> inventwithpython.com.
>
> There's something I dont understand, and i would really appreciate any
> help.
>
> In chapter
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
s not defined
>>>
If im not mistaken, it should return AB, AC, BA, etc.
I'm using Python 3.1
2010/7/28 Mark Lawrence
> On 27/07/2010 23:20, ZUXOXUS wrote:
>
>> Hi all pythoners
>>
>> I've got a probably easy to answer question.
>>
>>
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 m
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
2010/7/28 Dave Angel
>
>
> ZUXOXUS wrote:
>
>> Oh, I think i got it:
>>
>>
>>
>>> for prod in itertools.product('ABC', 'ABC'):
>>>>>
>>>>>
>>>> print(prod)
>>
>> ('A',
ode and voilá, the result displayed as I
want... But unfortunately I'm too newbie for this, or this is too hardcore:
def product(*args, **kwds):
# product('ABCD', 'xy') --> Ax Ay Bx By Cx Cy Dx Dy
# product(range(2), repeat=3) --> 000 001 010 011 100 10
2010/7/28 Alan Gauld
>
> "ZUXOXUS" wrote
>
>
>
> My doubt now is whether I can change the way python show the combinations.
>>
>
> Python will display the compbinations however you tell it to.
> The function generates the combinations the display
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
10 matches
Mail list logo