python

Random numbers List with no repetition - generate in python

The code will generate a random list with no repetitive numbers. This will contain 15 items and they will be selected from a range of 0 to 70.

import random

final_list = random.sample(range(70), 15)
print(final_list)
Output
[46, 14, 35, 17, 2, 13, 61, 15, 63, 30, 0, 43, 44, 39, 58]

-- Output will be different each time the code will run.
Was this helpful?