In this tutorial, you will learn about writing a python program to generate a random number.
Python random numbers between 1 and 10
In this example, we discuss the python random number between 1 and 10.
# Program to generate a random number between 1 and 10
# importing the random module
import random
print(random.randint(1,10))
Here is the out of the program.
PS C:\Users\PUSHPAM> python -u "C:\Users\PUSHPAM\AppData\Local\Temp\tempCodeRunnerFile.python"
2
Python Program to generate a random number between 1 and 100
In this example we discuss the python random number between 1 and 100. using the randint
function.
# Program to generate a random number between 0 and 100
# importing the random module
import random
print(random.randint(1,100))
Here is the OutPut this program.
96