How can I generate random integers between 0 and 9 using Python?

PythonServer Side ProgrammingProgramming

The randint() function in a random module returns a randomly generated integer in the given range. To obtain a random integer between 0 to 9,

>>> import random
>>> random.randint(0,9)
0
>>> random.randint(0,9)
5
>>> random.randint(0,9)
6
>>> random.randint(0,9)
8
raja
Published on 05-Mar-2018 05:24:51
Advertisements