To understand this example, you should have the knowledge of following Python programming topics:
To generate random number in Python, randint() function is used. This function is defined in random module.
# Program to generate a random number between 0 and 9
# import the random module
Note that, we may get different output because this program generates random number in range 0 and 9. The syntax of this function is:
This returns a number N in the inclusive range [a,b], meaning a <= N <= b, where the endpoints are included in the range.
a <= N <= b