Reputation: 473
My idea is as follows:
l=[]
for i in range(10):
l.append(random.randint(0,100))
But is there a more convenient way to generate a random list of ints since I've imported the random module?
Upvotes: 0
Views: 60
Reputation: 15120
Not sure what is most "convenient", but random.choices
returns a list of specified length from a given population.
random.choices(range(100), k=10)
Upvotes: 1