random.choice returns the same value

Brian ThisIsNotMyReal at ddress.com
Sat Sep 25 10:57:13 EDT 2004


Feel free to point and laugh.  I guess it was getting a little too late.

I was doing something like this where ComedyList and SciFiList are 
populated lists:

filelist = []

if var = "SciFi":
    	filelist = SciFiList
elif var = "Comedy":
    	filelist = ComedyList


I forgot to add the [:] at the end.  I am the win.



Erik Max Francis <max at alcyone.com> wrote in news:41550C26.18218493
@alcyone.com:

> Brian wrote:
> 
>> Any reason why random.choice would return the first value in a list
>> everytime?
> 
> Because the list only has one element, or all the elements have the same
> value?
> 




More information about the Python-list mailing list