I'm trying to generate a random list of 7 values and want to check the list for duplicate numbers and remove those from the list. I currently have:
import random
acard1 = random.randrange(0,13,1)
acard2 = random.randrange(0,13,1)
acard3 = random.randrange(0,13,1)
acard4 = random.randrange(0,13,1)
acard5 = random.randrange(0,13,1)
acard6 = random.randrange(0,13,1)
acard7 = random.randrange(0,13,1)
myhand=[acard1, acard2, acard3, acard4, acard5, acard6, acard7]
print(myhand)
How would I check if there are repeated values and then remove those values?
For example, if my list were [11, 7, 11, 12, 9, 9, 10]
,
how would I have my program recognize that 11 and 9 are repeated and turn the list into [7, 12, 10]
?