Sometimes, we want to generate random integers between 0 and 9 with Python.
In this article, we’ll look at how to generate random integers between 0 and 9 with Python.
How to generate random integers between 0 and 9 with Python?
To generate random integers between 0 and 9 with Python, w ecan use the random.randrange
method.
For instance, we write
from random import randrange
print(randrange(10))
to call randrange
with to 10 to generate a random number between 0 and 9.
Conclusion
To generate random integers between 0 and 9 with Python, w ecan use the random.randrange
method.