SyntaxFix
Write A Post
Hire A Developer
Questions
Apparently random.sample was introduced in python 2.3
random.sample
so for version under that, we can use shuffle (example for 4 items):
myRange = range(0,len(mylist)) shuffle(myRange) coupons = [ bestCoupons[i] for i in sorted(myRange[:4]) ]