How to draw any number from 0 to 9

Asked 2 years ago, Updated 2 years ago, 88 views

[0,9] I want to randomly pick a number in the range. What should I do?

python random

2022-09-21 16:39

1 Answers

random.randint(a,b) returns any number of integers in the range [a,b].

from random import randint
print(randint(0,9))

random.randrange(start, stop[, step]) returns any number of values in range(start, stop, step).

from random import randrange
irand = randrange(0, 10)


2022-09-21 16:39

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.