Ask your own question, for FREE!
Computer Science 17 Online
OpenStudy (anonymous):

In Python, how can you choose a random number from a range of numbers (and assign its value to x)?

OpenStudy (anonymous):

from random import randint randint(1,10)

OpenStudy (anonymous):

It's not working on Pyscripter. Is it not designed for that?

OpenStudy (anonymous):

Never used pyscripter but random is a built in module for python and should work. Are you on Windows or Linux?

OpenStudy (anonymous):

Yeah, this should work regardless of your IDE (although the upper value is not included).

OpenStudy (anonymous):

I'm using windows.

OpenStudy (anonymous):

Thanks, that worked.

OpenStudy (anonymous):

If you are on windows, open up your notepad and then paste the following code into notepad. from random import randint x = randint(1,10) print("Random value below") print(x) print "Press enter key to continue" a=raw_input() Save the file as test.py After saving the file as test.py you can double click on it and should work

OpenStudy (anonymous):

They need an edit feature here lol or do they have one and I have not found it lol Also, you are welcome

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Jalissa21: What does adenoma mea?
29 minutes ago 2 Replies 0 Medals
Twilightt: How Can We Prevent Gun Violence in American Schools?
29 minutes ago 4 Replies 1 Medal
Twaylor: possible?
2 days ago 5 Replies 0 Medals
Arriyanalol: hekp
4 days ago 33 Replies 0 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!