Backstory: Im the vice president of the assassin society, each week we assign our members a "target" they need to hunt down in the span of a week. I have a script that generates members targets
I need a method to make sure it doesnt repeat a target for at least 5 weeks per member. How would i go about this?
Heres the code that generates the targets:
targets = names
huntList = []
for member in names:
unique = False
while unique == False:
target = choice(targets)
if target == member:
unique = False
else:
targets.remove(target)
huntList.append([member, target])
unique = True
for item in huntList:
print(item[0], "is hunting", item[1])
And here is an example of the what "names" would be ['Daniel Allen','John Smith','Millie Stanford','Alex Tritton','Ashely Ward','Beth Madagen','Callum King','Charlie Brennan']
(names in the above list are random for the sake of privacy)
Aucun commentaire:
Enregistrer un commentaire