Re: [NEWB]: List with random numbers

2006-08-19 Thread eltower
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, eltower wrote: > > > Generate a random number from 0 to 6 > > Insert this random number to the end of a list unless the number is > > already there > > finish with a len(list) = 7 > > > > so far, I have this: > > > > import random > > > > ra

Re: [NEWB]: List with random numbers

2006-08-19 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, eltower wrote: > Generate a random number from 0 to 6 > Insert this random number to the end of a list unless the number is > already there > finish with a len(list) = 7 > > so far, I have this: > > import random > > random_list = [] > > while len(random_list) < 8: Wel

Re: [NEWB]: List with random numbers

2006-08-19 Thread Simon Forman
eltower wrote: > Hey all, > > I'm trying to write a program in Python for learning purposes which is > meant to: > > Generate a random number from 0 to 6 > Insert this random number to the end of a list unless the number is > already there > finish with a len(list) = 7 > > so far, I have this: > >

Re: [NEWB]: List with random numbers

2006-08-19 Thread faulkner
what you want is impossible. step back a second. you want 7 distinct ints all between 0 and 5 inclusive. of course you'll loop forever. once you get all 6 numbers, no matter what you get will already be in your list. if you want floats between 0 and 6, say '6 * random.random()'. random.randrange is

[NEWB]: List with random numbers

2006-08-19 Thread eltower
Hey all, I'm trying to write a program in Python for learning purposes which is meant to: Generate a random number from 0 to 6 Insert this random number to the end of a list unless the number is already there finish with a len(list) = 7 so far, I have this: import random random_list = [] whil