python random select no replace

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

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
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)