[Tutor] Need help with random numbers

ak@silmarill.org ak@silmarill.org
Mon, 16 Jul 2001 18:33:50 -0400


On Mon, Jul 16, 2001 at 04:30:30PM -0600, steve@purestfeeling.net wrote:
> Greetings my fellow fine Pythonistas.
> 
> Don't want to give too much away on what I'm trying to do, so I'm asking
> for help in one field.
> 
> I need to generate a random integer within certain bounds, say 1-10, and
> feed it into a variable for use elsewhere in the program, so A= the
> generated number.
> 
> What I was hoping, as a newbie, is that someone could give me an idea on
> how to do this. More specifically, the simplest way to do this for a stone
> cold(ish) newbie.
> 
> Thanks
> 
> -- 
> Steve - Editor - www.formulaoneupdate.com 
> -------------------------------------------------------------------
> "We put the 'M' in Stupid."

var = random.randrange(1,11)

> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor

-- 
Cymbaline: intelligent learning mp3 player - python, linux, console.
get it at: http://silmarill.org/cymbaline