In Python, how can you choose a random number from a range of numbers (and assign its value to x)?
from random import randint randint(1,10)
It's not working on Pyscripter. Is it not designed for that?
Never used pyscripter but random is a built in module for python and should work. Are you on Windows or Linux?
Yeah, this should work regardless of your IDE (although the upper value is not included).
I'm using windows.
Thanks, that worked.
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
They need an edit feature here lol or do they have one and I have not found it lol Also, you are welcome
Join our real-time social learning platform and learn together with your friends!