I intend to make lottery drawing program but first wanted to check the basic random module with a code:
from random import *
print(randint(1, 100))
Instead I receive a comment from cmd that contains output of some other file that I created
[Image: 2h6f2ts.png]
Did you happen to name one of your own programs random.py
?
The answer is negative. This is the first time that I tried to use random.
look like there can be a problem with you Python installation.
Do this from cmd.
Microsoft Windows [Version 10.0.15063]
(c) 2017 Microsoft Corporation. Med enerett.
C:\WINDOWS\system32>cd\
C:\>python
Python 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:14:34) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from keyword import iskeyword as _iskeyword
>>> _iskeyword
<built-in method __contains__ of frozenset object at 0x02EF0828>
>>>
[Image: zmo612.png]
Unfortunately this is what I get when type from keyword import iskeyword as _iskeyword
You typed the commands at the command line prompt instead of first typing
python
in order to be inside the python shell which has the command line starting with
>>>
. To summarize, the commands to type are:
cd\
python # after this command, the prompt will change to '>>>'
from keyword import iskeyword as _iskeyword
_iskeyword
[Image: 30u60pz.png]
Unfortunately, I'm not following you. This is what I see. What am I doing wrong?
Thanks. I reinstalled python and now random works fine.