Shuffle

Chris Angelico rosuav at gmail.com
Sat Sep 13 20:28:53 EDT 2014


On Sun, Sep 14, 2014 at 9:47 AM, Seymore4Head
<Seymore4Head at hotmail.invalid> wrote:
> 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

To understand this, you need to understand what the 'from' import does:

https://docs.python.org/3/tutorial/modules.html#more-on-modules

It's not the same as "import shuffle", but is a variant of "import random".

ChrisA



More information about the Python-list mailing list