[Tutor] Generating small random integer
John Fouhy
john at fouhy.net
Mon Feb 20 01:00:13 CET 2006
On 20/02/06, Kermit Rose <kermit at polaris.net> wrote:
> NameError: global name 'randint' is not defined
>
>
> In the function that calls randint, I placed the import command.
>
> def transfac(v):
> import random
> a = v[0]
You need to tell python that randint is in the random module.
ie, instead of calling randint(), call random.randint().
Have you been through the tutorial on python.org? It is quite helpful.
--
John.
More information about the Tutor
mailing list