Could anyone help walk me through the process of generating random numbers in Python?
More specifically, I'm trying to generate random numbers from a specified range.
Could anyone help walk me through the process of generating random numbers in Python?
More specifically, I'm trying to generate random numbers from a specified range.
For further actions, you may consider blocking this person and/or reporting abuse
Rishabh Singh âš¡ -
Rishabh Singh âš¡ -
Andrea Gonzales -
rwalroth -
Once suspended, richardb will not be able to comment or publish posts until their suspension is removed.
Once unsuspended, richardb will be able to comment and publish posts again.
Once unpublished, all posts by richardb will become hidden and only accessible to themselves.
If richardb is not suspended, they can still re-publish their posts from their dashboard.
Once unpublished, this post will become invisible to the public and only accessible to Richard B.
They can still re-publish the post if they are not suspended.
Thanks for keeping CodeNewbie Community 🌱 safe. Here is what you can do to flag richardb:
Unflagging richardb will restore default visibility to their posts.
Top comments (7)
@swizzard and @yechielk are right on here.
randint()
will return a number integer betweenrange_min
andrange_max
inclusive. So if you callrandint(1,10)
you will get a random integer equal to 1, 2, 3, ..., 9, 10.The
random
library has a number of useful functions in it for dealing with random things. For example if you need a random element from a list, usechoice()
:Documentation is here: docs.python.org/3/library/random.html
Awesome thank you so much. Taking a look at that documentation now 👀
Will give you a number between 1 and 100
thanks Yechiel 😀
Hi. I wrote a Cheatsheet here which covers random strings, integers, floats and more.
michaelcurrin.github.io/dev-cheats...
Some comments may only be visible to logged-in visitors. Sign in to view all comments.