Ask your own question, for FREE!
Computer Science 24 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!
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!