Easy enough. You'll want to import the random module and use the functions in it. Also, http://docs.python.org/lib/lib.html is going to be your best friend. You'll notice on that page among many other things is a section on random number generation.
As to your code: >>>import random >>>a = random.randint(1,20) >>>a 3 On Dec 4, 2007 12:56 PM, earlylight publishing < [EMAIL PROTECTED]> wrote: > Hello All, > > I'm a bare beginner to python (or indeed) any programming. I'm helping > myself become more proficient by making a text adventure game. The problem > is I need a function (or module) that will generate a random number within a > range, say 1-20 for example. The ability to program this is beyond my > meager abilities at the moment but I'd really like to get started. Would > anyone out there be willing to provide me the code for me? Or at least > point me in the right direction for finding it myself? > > TYIA > :-) > > ------------------------------ > Be a better pen pal. Text or chat with friends inside Yahoo! Mail. See > how. <http://us.rd.yahoo.com/evt=51732/*http://overview.mail.yahoo.com/> > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > >
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor