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

2015-09-28 Thread Oscar Benjamin
On 27 September 2015 at 12:39, marcus lütolf wrote: > Hello Martin. > I never exspected to get such motivating comments and advice !!! Thank you > again. > Referring to my statments below > > 1. I explain my task in plain text: > Flights (in golfers language) or Triples (in computer language) com

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

2015-09-27 Thread Martin A. Brown
Hello Marcus, I never exspected to get such motivating comments and advice !!! Thank you again. Much appreciated! Each of us contributes to this mailing list in some way or another. And, not a one of us sprang fully-formed from Zeus's head with our Python expertise. 1. I explain my tas

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

2015-09-27 Thread marcus lütolf
rcus. -Ursprüngliche Nachricht- Von: Martin A. Brown [mailto:mar...@linux-ip.net] Gesendet: Samstag, 26. September 2015 19:38 An:

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

2015-09-27 Thread marcus lütolf
itertools. I hope I can be successfull with your code below although it will me take time to comprehend it. Sorry for this long text, regards, Marcus. -Ursprüngliche Nachricht- Von: Martin A. Brown [mailto:mar...@linux-ip.net] Gesendet: Dienstag, 22. September 2015 03:10 An: marcus lütolf Cc

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

2015-09-26 Thread Martin A. Brown
no shame in writing code and throwing it away if it helps you get closer to the solution. It's common (and a good idea) to throw away code. I hope I can be successfull with your code below although it will me take time to comprehend it. Don't worry unduly about my code. Note tha

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

2015-09-22 Thread Oscar Benjamin
On 21 September 2015 at 22:54, Francesco A. Loffredo wrote: >> > Still thinking about it. I have read about Steiner systems and the Social > Golfer problem, and I'm afraid this will remain an Unsolved Problem despite > my efforts. Up to now, I thought that backtracking can't be a solution, > unles

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

2015-09-21 Thread Martin A. Brown
Marcus, I have more questions for you, as well as a possible solution (though it's a bit more verbose than I would have liked to offer). Question: Problem A: Are you looking to identify the complete set of possible options for constructing the triples of pairs? Problem B: Are you loo

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

2015-09-21 Thread Francesco A. Loffredo via Tutor
On 15/09/2015 23.14, Francesco A. Loffredo wrote: On 14/09/2015 13:50, Oscar Benjamin wrote: ... Your algorithm loops through all triples and accepts any triple if it doesn't immediately conflict with any of the triples already accepted. If you were solving a sud

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

2015-09-21 Thread Martin A. Brown
Hello again Marcus, My task is to have lists containing 3 tuples, each tuple ocurring only once. In my code above I started off with 6 tuples ( = s) of which 20 lists (count) are produced containing each of the 6 tuples multiple times. Below, I'm confirming that there are 325 input "tuples"

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

2015-09-21 Thread marcus lütolf
on: Tutor [mailto:tutor-bounces+marcus.luetolf=bluewin...@python.org] Im Auftrag von Alan Gauld Gesendet: Freitag, 18. September 2015 18:58 An: tutor@python.org Betreff: Re: [Tutor] Creating lists with 3 (later4) items occuring only once On 18/09/15 16:41, marcus lütolf wrote: >>>> s

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] Creating lists with definite (n) items without repetitions

2015-09-15 Thread Francesco A. Loffredo via Tutor
On 14/09/2015 13:50, Oscar Benjamin wrote: On 10 September 2015 at 08:45, Francesco Loffredo via Tutor wrote: I wrote a small routine (below) to check when and if my code and the formula do match. It easily shows that they only match for len(pool) == (2 ** N) - 1, with N greater or equal to 2.

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

2015-09-14 Thread Oscar Benjamin
On 10 September 2015 at 08:45, Francesco Loffredo via Tutor wrote: > > I wrote a small routine (below) to check when and if my code and the formula > do match. It easily shows that > they only match for len(pool) == (2 ** N) - 1, with N greater or equal to 2. That's interesting. I'm not sure exac

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

2015-09-10 Thread Francesco Loffredo via Tutor
On 09/09/2015 19:45, Francesco Loffredo via Tutor wrote: On 09/09/2015 18:59, Oscar Benjamin wrote: I don't think the code above works. For n=27 it should count 117 (according to the formula I showed) but instead it comes up with 101. I tried it with a smaller n by setting pool to range(1, 9+1)

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

2015-09-09 Thread Francesco Loffredo via Tutor
On 09/09/2015 18:59, Oscar Benjamin wrote: On 9 September 2015 at 12:05, Francesco Loffredo via Tutor wrote: A quick solution is to add one "dummy" letter to the pool of the OP's golfers. I used "!" as the dummy one. This way, you end up with 101 triples, 11 of which contain the dummy player. B

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

2015-09-09 Thread Oscar Benjamin
On 9 September 2015 at 12:05, Francesco Loffredo via Tutor wrote: > Oscar Benjamin wrote: > > The problem is that there are 26 people and they are divided into > groups of 3 each day. We would like to know if it is possible to > arrange it so that each player plays each other player ex

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

2015-09-09 Thread Francesco Loffredo via Tutor
Oscar Benjamin wrote: The problem is that there are 26 people and they are divided into groups of 3 each day. We would like to know if it is possible to arrange it so that each player plays each other player exactly once over some period of days. It is not exactly possible to

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

2015-09-07 Thread Oscar Benjamin
On 5 September 2015 at 23:28, Mark Lawrence wrote: > On 05/09/2015 10:09, Peter Otten wrote: >> >>> the 5 lists above do not match my task insofar as every of the 5 lists >>> contains 'a' and 'b' which should occur only once, hence my count of a >>> maximum of 301 lists, which might nor be correc

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

2015-09-06 Thread Marc Tompkins
On Fri, Sep 4, 2015 at 7:28 AM, marcus lütolf wrote: > I should probably tell you the real task are a series (maximum ~ 301) > lists in which real names of people are assigned to the items/letters for > 2 people(golfers) can be in the same list(flight) only once for an > extended period of tim

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

2015-09-06 Thread Steven D'Aprano
Hello Marcus, On Fri, Sep 04, 2015 at 04:28:10PM +0200, marcus lütolf wrote: [...] > I should probably tell you the real task are a series (maximum ~ 301) > lists in which real names of people are assigned to the items/letters > for 2 people(golfers) can be in the same list(flight) only once fo

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

2015-09-05 Thread Mark Lawrence
On 05/09/2015 10:09, Peter Otten wrote: marcus lütolf wrote: Hello Peter, hello Martin, many thanks for your very quick response !!! As for Peter's advice: the 5 lists above do not match my task insofar as every of the 5 lists contains 'a' and 'b' which should occur only once, hence my count

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

2015-09-05 Thread Peter Otten
Peter Otten wrote: [proofreading goof] > OK, you want all triples where no pair inside a triple is repeated. > There are 325 pairs, and one triple uses up three pairs. > That puts an upper limit of 325/3 = 108 on the number of triples. > You then have to find all sets of three > pairs where th

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

2015-09-05 Thread Peter Otten
marcus lütolf wrote: > Hello Peter, hello Martin, > many thanks for your very quick response !!! > > As for Peter's advice: > >> At first I thought you might want itertools.combinations() >> > import string, itertools > for t in itertools.combinations(string.ascii_lowercase, 3): >> ...

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

2015-09-04 Thread marcus lütolf
Hello Peter, hello Martin, many thanks for your very quick response !!! As for Peter's advice: > At first I thought you might want itertools.combinations() > import string, itertools for t in itertools.combinations(string.ascii_lowercase, 3): > ... print t # list(t) if you actually

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

2015-09-03 Thread Danny Yoo
> At first I thought you might want itertools.combinations() > import string, itertools for t in itertools.combinations(string.ascii_lowercase, 3): > ... print t # list(t) if you actually need a list > ... > ('a', 'b', 'c') > ('a', 'b', 'd') > ('a', 'b', 'e') > ('a', 'b', 'f') > ('a',

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

2015-09-03 Thread Mark Lawrence
On 03/09/2015 14:32, Marcus Lütolf wrote: dear pythonistats as a newcomber I want to create a set of lists containing n items, for example n = 3: (['a','b','c'], ['a','d','e']...). The sequence of items in each list should be different. If the letters 'a''z' are used and n = 3 there

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

2015-09-03 Thread Martin A. Brown
Greetings Marcus, Peter Otten has also responded, recommending itertools. I think both he and I are not sure how you wish to generate your result list (or lists). But, I have a comment or two. dear pythonistats as a newcomber I want to create a set of lists containing n items, for exampl

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

2015-09-03 Thread Peter Otten
Marcus Lütolf wrote: > as a newcomber I want to create a set of lists containing n items, for > example n = 3: (['a','b','c'], ['a','d','e']...). > The sequence of items in each list should be different. If the letters > 'a''z' are used and n = 3 there is a maximum of 301 lists. > The

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

2015-09-03 Thread Marcus Lütolf
dear pythonistats as a newcomber I want to create a set of lists containing n items, for example n = 3: (['a','b','c'], ['a','d','e']...). The sequence of items in each list should be different. If the letters 'a''z' are used and n = 3 there is a maximum of 301 lists. The following

Re: [Tutor] Creating Lists

2014-11-12 Thread Steven D'Aprano
On Wed, Nov 12, 2014 at 04:27:33AM +, niyanax...@gmail.com wrote: > Create a list of 20 unique (no number appears twice) random integers with > values > between 1 and 45. Here is how I would produce a list of 7 unique random integers with values between 123 and 175. Lines starting with "p

Re: [Tutor] Creating Lists

2014-11-12 Thread Ben Finney
writes: > Create a list of 20 unique (no number appears twice) random integers > […] Print the list with the header “The list with the largest and > smallest number removed: ” That all sounds like a good assignment. Feel free to show us your complete program and we can offer advice. This is a f

Re: [Tutor] Creating Lists

2014-11-12 Thread Alan Gauld
On 12/11/14 04:27, niyanax...@gmail.com wrote: Create a list of 20 unique (no number appears twice) random integers with values between 1 and 45. > Print the list of random numbers with the header “Random list of 20 numbers”. Find the largest number in the list. > Remove the largest number

[Tutor] Creating Lists

2014-11-12 Thread niyanaxx95
Create a list of 20 unique (no number appears twice) random integers with values between 1 and 45. Print the list of random numbers with the header “Random list of 20 numbers”. Find the largest number in the list. Remove the largest number from the list. Find the smallest number in the list.