Seymore4Head Seymore4Head at Hotmail.invalid
Sun Sep 14 04:10:08 CEST 2014

On Sat, 13 Sep 2014 19:32:55 -0600, Michael Torrie <torriem at>

>On 09/13/2014 05:47 PM, Seymore4Head wrote:
>> Here is a screenshot of me trying Dave Briccetti's quiz program from
>> the shell and it (the shuffle command) works.
>> Two questions
>> If you import random, do you need to "from random import shuffle"?
>> Why does shuffle work from the command line and not when I add it to
>> this program?
>> import random
>> import shuffle
>> nums=list(range(1,11))
>> shuffle(nums)
>> print (nums)
>> I get:
>> No module named 'shuffle'
>You can do it two ways:
>Refer to it as random.shuffle()
>from random import shuffle
>I tend to use the first method (random.shuffle).  That way it prevents
>my local namespace from getting polluted with random symbols imported
>from modules.


More information about the Python-list mailing list