random number between 0 and 20

Peter Hansen peter at engcorp.com
Wed Apr 20 11:10:21 EDT 2005


aleksander.helgaker at gmail.com wrote:
> How can I generate a random number between 0 - 20 and store the number
> in nrrandom?

You would use the "random" module from the standard
library.  It has a randint() method that should do
the job.  Read the docs for more.

Assigning to nrrandom?  Is that just a variable
name?  Have you read the tutorial, which covers
basic things like assignment?

-Peter



More information about the Python-list mailing list