Generating a random number

Ron White rwhite at netins.net
Sat Oct 6 12:25:50 EDT 2001


Hi,
When I used the following I got:

>>> from random import randrange
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in ?
    from random import randrange
  File "C:\PYTHON21\Tools\idle\random.py", line 3
    for i in range(10):
    ^
SyntaxError: invalid syntax
>>>

The one thing that has worked is from Dale Strickland-Clark.  That is:

from whrandom import randint

print randint(1, 10)

I wonder if my random module is corrupt?

Ron



"Ron White" <rwhite at netins.net> wrote in message
news:9plkkk$98r$1 at ins22.netins.net...
> Will someone please tell me exactly how to generate a random number from 1
> to 10 in Python 2.1.1 running under windows me?  I'm beginning to think
> there is something wrong with my installation or I'm just not smart enough
> to understand what I read.
>
> Thank you for any help.
> Ron
>
> --
> Ron White
> Amateur Radio  WA0MWW
>
>
>





More information about the Python-list mailing list