Sunday, July 22, 2018

python - Generate random integers between 0 and 9



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

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...