So I have this for a sound crew to select jobs for workers based on the training they have recieved. My code allows you to add workers to the list and set what jobs they are allowed to do through use of inputs. The second Function then randomly creates job assignments for people based on the parameters in the first function. I would like to be able to have people selected, with no repeats, and preferably without permanently deleting people from the lists, so that the lists can be saved permanently.
With the current code i get the error ValueError: list.remove(x): x not in list.
What do you think I am missing guys? Thanks for all input!
import random
my_list = []
stage_list = []
mic_list = []
sound_list = []
def addto_list():
addto = input()
stage = input("Can he do stage?(y/n): ")
if stage == "y":
stage_list.append(addto)
mic = input("Can he do mic?(y/n): ")
if mic == "y":
mic_list.append(addto)
sound = input("Can he do sound?(y/n): ")
if sound == "y":
sound_list.append(addto)
my_list.append(addto)
def create_assignment():
stage_assign = random.choice(stage_list)
stage_list.remove(stage_assign)
mic_list.remove(stage_assign)
sound_list.remove(stage_assign)
print("Stage: " + stage_assign)
micleft_assign = random.choice(mic_list)
mic_list.remove(micleft_assign)
stage_list.remove(micleft_assign)
sound_list.remove(micleft_assign)
print("Left Mic: " + micleft_assign)
micright_assign = random.choice(mic_list)
mic_list.remove(micright_assign)
stage_list.remove(micright_assign)
sound_list.remove(micright_assign)
print("Right Mic: " + micright_assign)
sound_assign = random.choice(sound_list)
print("Sound: " + sound_assign)