Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #36192

Re: Random List Loop?!

References <ce887da5-1fad-49af-85e3-96ca41b7148c@googlegroups.com>
Date 2013-01-05 16:02 +0000
Subject Re: Random List Loop?!
From Oscar Benjamin <oscar.j.benjamin@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.130.1357401741.2939.python-list@python.org> (permalink)

Show all headers | View raw


On 5 January 2013 15:47, Christian Gabriel <gabrieldenmark@gmail.com> wrote:
> Hi
>
> I have tried now for ages to make a loop that does the following:
>
> Makes a new list with 9 random values, from 9 different lists, with 9 elements.
>
> And makes sure that none of the elements repeat!
>
> Is there anyone that can help, with a very simple solution??

I'm sure that there is a simple solution but I don't fully understand
your problem could you perhaps provide an example with actual numbers
(perhaps use 3 instead of 9 so it's easier to follow)?

In any case I suspect that you want something involving range() and
random.shuffle() if that helps.


Oscar

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Random List Loop?! Christian Gabriel <gabrieldenmark@gmail.com> - 2013-01-05 07:47 -0800
  Re: Random List Loop?! Roy Smith <roy@panix.com> - 2013-01-05 10:54 -0500
  Re: Random List Loop?! Chris Angelico <rosuav@gmail.com> - 2013-01-06 02:59 +1100
  Re: Random List Loop?! Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-01-05 16:02 +0000

csiph-web