How can I generate random integers between 0 and 9 (inclusive) in Python?
For example, 0, 1, 2, 3, 4
0
1
2
3
4
random.sample is another that can be used
random.sample
import random n = 1 # specify the no. of numbers num = random.sample(range(10), n) num[0] # is the required number