mylist = [] import random while len(mylist) != 6 : num1 = random.randint(1, 40) mylist.append(num1) num2 = random.randint(1, 40) mylist.append(num2) num3 = random.randint(1, 40) mylist.append(num3) num4 = random.randint(1, 40) mylist.append(num4) num5 = random.randint(1, 40) mylist.append(num5) num6 = random.randint(1, 40) mylist.append(num6) mylist = list(dict.fromkeys(mylist)) print ( "lottery numbers: ", mylist )