python random select no replace

Solutions on MaxInterview for python random select no replace by the best coders in the world

showing results for - "python random select no replace"
Maximiliano
20 Apr 2018
1import random
2
3aList = [20, 40, 80, 100, 120]
4print ("choosing 3 random items from a list using random.sample() function")
5sampled_list = random.sample(aList, 3)
6print(sampled_list)