> Yes, you need to unpack the result of calling windex(). You so ably
> demonstrated unpacking the list in your for loop I thought you would
> figure it out :-)
>
> Try
>lst_name, lst = windex(x)
>
> then random.choice() and print.
>
Thanks Kent i got it, just another brain-fart on my side...
kevin parks wrote:
>>From: Kent Johnson <[EMAIL PROTECTED]>
>>If you want to be able to print the name of the list then you could
>>include both the name and the actual list in x:
>>
>> x = [(('lst_a', lst_a), .50), etc...]
>
>
>
> That produces:
> ('lst_c', ['Ale', 'Lager', 'Pilsner', 'Boc
On Mar 11, 2006, at 3:24 PM, [EMAIL PROTECTED] wrote:
>
> Message: 1
> Date: Sat, 11 Mar 2006 08:34:49 -0500
> From: Kent Johnson <[EMAIL PROTECTED]>
> Subject: Re: [Tutor] weighted choices from among many lists
> Cc: tutor@python.org
> Message-ID: <[EMAIL PROTECTE
kevin parks wrote:
> I have several lists... and i would like to some times chose from one
> list and for a while choose from a different list, etc.
You don't say what isn't working but I have a guess. The actual windex()
function looks OK to me.
> def test():
>
> lst_a = [ 'red', 'green
I have several lists... and i would like to some times chose from one
list and for a while choose from a different list, etc... so i cooked
this up and it almost works so that i can get colors 50% of the time,
doggies 25%, beer 10%, and guitars 100% (if i was real smart i would
make my index th