from random import shuffle lottery = list(range(1,40)) numbers = [] for i in range (6): shuffle(lottery) x = lottery.pop() numbers.append(x) numbers.sort() print ("lottery numbers:", numbers)