Re: [Tutor] Creating lists with definite (n) items without repetitions

2015-09-18 Thread Alan Gauld
On 18/09/15 16:17, marcus lütolf wrote: dear pythonistas, in the code below: how can I solve my task wit n items ? Thank you for help, Marcus. I see no code... -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo

Re: [Tutor] Creating lists with 3 (later4) items occuring only once

2015-09-18 Thread Alan Gauld
On 18/09/15 16:41, marcus lütolf wrote: s = ['ab','ac','bc','ad','ae','de'] for startlist in itertools.combinations(s, 3): How can I concatenate the 20 lists in oder to get one count for each of the items in s , for example 10 for 'ab'? If I understand you correctly, something like this:

[Tutor] Creating lists with 3 (later4) items occuring only once

2015-09-18 Thread marcus lütolf
dear pythonistas in the code below >>> import string, itertools >>> s = ['ab','ac','bc','ad','ae','de'] >>> count = 0 >>> for startlist in itertools.combinations(s, 3): >>> count = count + 1 >>> stl = list(startlist) >>> print count, stl >>> for pair in s: >>> x = stl

[Tutor] Creating lists with definite (n) items without repetitions

2015-09-18 Thread marcus lütolf
dear pythonistas, in the code below: how can I solve my task wit n items ? Thank you for help, Marcus. --- Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft. https://www.avast.com/antivirus ___ Tutor maillist - Tutor@python.org To

Re: [Tutor] Tutor Digest, Vol 139, Issue 29 Calling instance method in IDLE magically calls __len__?

2015-09-18 Thread Dino Bektešević
Hello all, > Hi Dino, > > > I'm afraid I cannot replicate that behaviour. Also the output seems > strange -- the "len is called" is printed on the same line as the > prompt, and e.toFile( afterwards. > > If you quit idle and restart it, do you get the same behaviour? What's > the exact version of

Re: [Tutor] Calling instance method in IDLE magically calls __len__?

2015-09-18 Thread Peter Otten
Dino Bektešević wrote: > Hello, > > For full disclosure, I'm using Python2.7 on Ubuntu 14.04. MWE bellow and > at https://bpaste.net/show/3d38c96ec938 (until 2015-09-25 06:29:54, in the > case spaces get messed up). > > class Errors: > def __init__(self): > pass > def toFile(self

Re: [Tutor] syntax error

2015-09-18 Thread Nym City via Tutor
-Perfect. Thank you. On Tuesday, September 15, 2015 5:00 AM, Alan Gauld wrote: On 15/09/15 02:41, Nym City via Tutor wrote: > Hello, > I am also just trying to understand this code and could not understand the > print statement.I would have just used: >  print('cost:$',gross_cost

Re: [Tutor] Calling instance method in IDLE magically calls __len__?

2015-09-18 Thread Steven D'Aprano
Hi Dino, On Fri, Sep 18, 2015 at 09:10:00AM +0200, Dino Bektešević wrote: > Hello, > > For full disclosure, I'm using Python2.7 on Ubuntu 14.04. MWE bellow and at > https://bpaste.net/show/3d38c96ec938 (until 2015-09-25 06:29:54, in the > case spaces get messed up). > > class Errors: > def _

[Tutor] Calling instance method in IDLE magically calls __len__?

2015-09-18 Thread Dino Bektešević
Hello, For full disclosure, I'm using Python2.7 on Ubuntu 14.04. MWE bellow and at https://bpaste.net/show/3d38c96ec938 (until 2015-09-25 06:29:54, in the case spaces get messed up). class Errors: def __init__(self): pass def toFile(self): pass def __len__(self):