Python program to generate a random number

Python program to generate a random number

Python program to generate a random number

In this program, we will learn how to generate a random number in python

To generate a random number in python we use a function randint() 

#python program to generate a random number

import random
print(random.randint(1,10))

Output

7

Note:- As many times as you run this program you may get a different output because we have used a random function.

If you like my post please share it with your friends by simply clicking the below social media button, and Don’t forget to comment so we will update ourselves.

Share in a Single Click

Leave a Reply

Your email address will not be published. Required fields are marked *