How to generate random number between 1 and 10 in Python 3
Let’s see how to get a random number between 1 and 10 in python 3 using the random module.
The randint() function of the random module returns the random number between two given numbers. To get a random number between 1 and 10, pass 1 and 10 as the first and second arguments respectively.
#/usr/bin/python3 import random random_number = random.randint(1, 10) print(random_number)
The above python code will return a random integer between 1 and 10 each time you run the programme (Including 1 and 10).
So that is how we can generate a random number between 1 and 10 in python 3.