# The library required to generate random numbers import random
# Generate a random int between 1 and 10 random_integer = random.randint(1, 10)
# Print out the generated integer print(random_integer)
The Python randint() can generate random integers by getting as arguments the lower and the upper bound integers of the range you want the integer to be picked from.
Learn Flask development and learn to build cool apps with our premium Python course on Udemy.
We will keep you Python-motivated if you subscribe below.