def fill2_line1():
x2 = random.choice(list(twoSyllValues.items()))
line1.append(x2)
magicList = ([x[1] for x in line1])
if 1 in magicList:
fill2_line1()
fill2_line1()
complete_line = line1[0][0] + " " + line1[1][0] + " " +
line1[2][0]
print(complete_line)
This is the part in question - the whole program is over 150 lines. It works perfectly as is, but sometimes I'm getting duplicated words. To refine the code, I want to make sure that the key in the first random tuple selection is not duplicated in the next two selected tuples IN that list, line1. The only way I can think of is having another dictionary created after the first word selection and then exclude that key,value pair from new dictionary and then make the next two random.choice calls. I feel like there must be a simpler way, but I just don't have the experience yet.