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
Answer
Try:
from random import randrange
print(randrange(10))
More info: http://docs.python.org/library/random.html#random.randrange
No comments:
Post a Comment