Home >>Python Programs >How to generate a random number in python
In this example, we will see how we can generate a random number(integer, doubles, longs) etc . In various ranges by importing a "random" class in Python language. For generating a random number in Python first we have to import the random module.
Example 1:
import random
print(random.randint(100,500))
import random
print(random.randint(100,500))