How can I generate random integers between 0 and 9 (inclusive) in Python?
For example, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
0
1
2
3
4
5
6
7
8
9
Try:
from random import randrange print(randrange(10))
Docs: https://docs.python.org/3/library/random.html#random.randrange
1.4m articles
1.4m replys
5 comments
57.0k users