Python Program to Generate Random Number

This program demonstrates how to generate random number in python using the randint method.

How to generate random number in Python?

Inorder to generate random number in Python, you will need to use the randint() function which is defined in the random module() in python.

# Author : Abandantcode.com
# Program to generate a random number between 1 and 100

# importing the random module
import random

print(random.randint(1,100))

Output

7

Everytime when the randint function is called , it generates a different output as it is printed.