import random randomlist = [] for i in range(0,6): n = random.randint(1,40) randomlist = random.sample(range(10, 40), 6) print(randomlist)