random.choice returns the same value

Discussion in 'Python' started by Brian, Sep 25, 2004.

  1. Brian

    Brian Guest

    Any reason why random.choice would return the first value in a list
    everytime?
    Brian, Sep 25, 2004
    #1
    1. Advertising

  2. 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?

    --
    __ Erik Max Francis && && http://www.alcyone.com/max/
    / \ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
    \__/ In Heaven all the interesting people are missing.
    -- Friedrich Nietzsche
    Erik Max Francis, Sep 25, 2004
    #2
    1. Advertising

  3. Brian

    Peter Hansen Guest

    Brian wrote:
    > Any reason why random.choice would return the first value in a list
    > everytime?


    Code sample so we don't have to guess?

    -Peter
    Peter Hansen, Sep 25, 2004
    #3
  4. Brian

    Brian Guest

    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 <> 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?
    >
    Brian, Sep 25, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mickey Segal
    Replies:
    0
    Views:
    856
    Mickey Segal
    Feb 2, 2004
  2. Replies:
    4
    Views:
    1,369
  3. miles.jg
    Replies:
    16
    Views:
    855
    Alf P. Steinbach
    Nov 14, 2007
  4. globalrev
    Replies:
    4
    Views:
    742
    Gabriel Genellina
    Apr 20, 2008
  5. VK
    Replies:
    15
    Views:
    1,121
    Dr J R Stockton
    May 2, 2010
Loading...

Share This Page