Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie question: random
#1
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]
Reply
#2
Did you happen to name one of your own programs random.py?
Reply
#3
The answer is negative. This is the first time that I tried to use random.
Reply
#4
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>
>>> 
Reply
#5
[Image: zmo612.png]

Unfortunately this is what I get when type from keyword import iskeyword as _iskeyword
Reply
#6
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
Reply
#7
[Image: 30u60pz.png]

Unfortunately, I'm not following you. This is what I see. What am I doing wrong?
Reply
#8
Your OS environment path is not set to point to pythnon.
There is possibly to fix this,but i suspect that there something wrong with your Python installation.
Start on scratch and follow this Python 3.6 and pip installation under Window, part-2.
Reply
#9
Thanks. I reinstalled python and now random works fine.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How is pandas modifying all rows in an assignment - python-newbie question markm74 1 705 Nov-28-2023, 10:36 PM
Last Post: deanhystad
  newbie question - can't make code work tronic72 2 696 Oct-22-2023, 09:08 PM
Last Post: tronic72
  Newbie question about switching between files - Python/Pycharm Busby222 3 623 Oct-15-2023, 03:16 PM
Last Post: deanhystad
  Newbie.... run for cover. OpenCV question Stevolution2023 2 990 Apr-12-2023, 12:57 PM
Last Post: Stevolution2023
  numpy newbie question bcwilly_ca 4 1,195 Feb-10-2023, 05:55 PM
Last Post: jefsummers
  Question from complete python's newbie Davicom 3 2,381 Jun-09-2021, 06:09 PM
Last Post: bowlofred
  Newbie question about running Python via GUI on OSX ejwjohn 8 3,527 Feb-05-2021, 03:20 PM
Last Post: Larz60+
  super newbie question: escape character tsavoSG 3 2,485 Jan-13-2021, 04:31 AM
Last Post: tsavoSG
  newbie question....importing a created class ridgerunnersjw 5 2,679 Oct-01-2020, 07:59 PM
Last Post: ridgerunnersjw
  Dumb newbie question JonEdward 5 3,275 Jul-22-2020, 10:06 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020