We should use the for loop with the randint() method to generate a list of random numbers. To do so, we must first create an empty list, after which we must add the generated random numbers one by one to the empty list.
import random
ran_list = []
for i in range(0,5):
#generating random numbers
n = random.randint(10,150)
ran_list.append(n)
print(ran_list)
Output:
[28, 79, 32, 44, 142]
Also Read:
Generate Random Number in Python