I'm trying to create two random lists of 5 numbers between 1-20 and compare them. This is what I got so far:
import random
list1 = []
list2 = []
loop = 0
while loop < 5:
    nmbr1 = random.randint(1, 20)
    nmbr2 = random.randint(1, 20)
    loop += 1
    list1.append(nmbr1)
    list1.sort()
    list2.append(nmbr2)
    list2.sort()
print (list1)
print (list2)
result = sorted(list1) == sorted(list2)
if result == True:
    print("Congratulations, you've won a Lottery!!")
Now, here are some problems that I'm getting:
I'm getting multiple same numbers in the list, for example: ;[3, 3, 5, 13, 16]; I have two "3" in one list. How can I make a condition or something that the same number cannot be randomly created in one list?
I would like to create a while loop that will randomly create two lists until they are a match and then print out this message that I have in my code.
Is it possible to make a function of this number randomizer code so instead of making it like I did it, it is actually a function?
 
     
     
     
    