Generate random integers between 0 and 9 Generate random integers between 0 and 9 python python

Generate random integers between 0 and 9


import randomprint(random.randint(0,9))

random.randint(a, b)

Return a random integer N such that a <= N <= b.

Docs: https://docs.python.org/3.1/library/random.html#random.randint


Try this:

from random import randrange, uniform# randrange gives you an integral valueirand = randrange(0, 10)# uniform gives you a floating-point valuefrand = uniform(0, 10)


matomo