import random rand1 = random.randint(1,40) rand2 = random.randint(1,40) rand3 = random.randint(1,40) rand4 = random.randint(1,40) rand5 = random.randint(1,40) rand6 = random.randint(1,40) while rand1 == rand2 or rand1 == rand3 or rand1 == rand4 or rand1 == rand5 or rand1 == rand6: rand1 = random.randint(1,40) while rand2 == rand3 or rand2 == rand1 or rand2 == rand4 or rand2 == rand5 or rand2 == rand6: rand2 = random.randint(1,40) while rand3 == rand1 or rand3 == rand4 or rand3 == rand2 or rand3 == rand5 or rand3 == rand6: rand3 = random.randint(1,40) while rand4 == rand1 or rand4 == rand2 or rand4 == rand3 or rand4 == rand5 or rand4 == rand6: rand4 = random.randint(1,40) while rand5 == rand1 or rand5 == rand2 or rand5 == rand3 or rand5 == rand4 or rand5 == rand6: rand5 = random.randint(1,40) while rand6 == rand1 or rand6 == rand2 or rand6 == rand3 or rand6 == rand4 or rand6 == rand5: rand6 = random.randint(1,40) print("Lottery numbers: ",rand1,rand2,rand3,rand4,rand5,rand6)