I am learning python for a class but want do do some of my own things with it as well as assignments. I have some things started, but one thing that is really holding my programs back is that I can't figure out how to make a random number/integer. I have tried the things on the website but cant get them to work. Anybody know a way?
Maybe something like what is suggested here would help you:

Code:
from random import randint
print(randint(0,9))

I would suggest consulting the documentation page on the random library for more information.
Is there anything I need to do to get the library (download, etc.) or is it a built in thing?
Kydapoot wrote:
Is there anything I need to do to get the library (download, etc.) or is it a built in thing?

The 'random' library is built in to python.
Thanks! It worked great.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement