[Tutor] I don't understand this code

2010-07-14 Thread 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 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.

Re: [Tutor] I don't understand this code

2010-07-16 Thread ZUXOXUS
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

[Tutor] Calculating and returning possible combinations of elements from a given set

2010-07-27 Thread ZUXOXUS
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

Re: [Tutor] Calculating and returning possible combinations of elements from a given set

2010-07-27 Thread ZUXOXUS
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. >> >>

Re: [Tutor] Calculating and returning possible combinations of elements from a given set

2010-07-27 Thread ZUXOXUS
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

Re: [Tutor] Calculating and returning possible combinations of elements from a given set

2010-07-27 Thread ZUXOXUS
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

Re: [Tutor] Calculating and returning possible combinations of elements from a given set

2010-07-28 Thread ZUXOXUS
2010/7/28 Dave Angel > > > ZUXOXUS wrote: > >> Oh, I think i got it: >> >> >> >>> for prod in itertools.product('ABC', 'ABC'): >>>>> >>>>> >>>> print(prod) >> >> ('A',

Re: [Tutor] Calculating and returning possible combinations of elements from a given set

2010-07-28 Thread ZUXOXUS
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

Re: [Tutor] Calculating and returning possible combinations ofelements from a given set

2010-07-28 Thread ZUXOXUS
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

Re: [Tutor] Calculating and returning possible combinations of elements from a given set

2010-07-29 Thread ZUXOXUS
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&#x