[Tutor] Idle

Michael Connors connorsml at gmail.com
Fri Mar 14 11:41:56 CET 2008


>
> It all works up until I need to print five randomly chosen numbers from
> the range [1,n]. It tells me that random is not defined.


You need to put :
import random

in your program before doing: y = random.randrange(1,n)

or alternatively use:
from random import *

and call the function as follows:
y = randrange(1,n)

Regards,

-- 
Michael Connors
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080314/52c99547/attachment.htm 


More information about the Tutor mailing list