Program to Generate a Random Number in Python

randint() function is used to generate random number. This function is defined in random module. 

# importing the random module

>>> import random
>>> print(random.randint(9, 23))
18
>>> 

The syntax of this function is:

random.randint(x,y)

 

Total Views: 446