I am trying to create an anagram maker. However, when I run this code the while loop goes on forever, and "combinations" doesn't seem to be getting items added to it. Why is this the case?
This question was marked as a duplicate and I'm not sure why. This is the first time I've asked it. I'd appreciate if you'd answer it.
x = input("Give us a word and I will supply all possible anagrams: ")
list = []
combinations = [x]
for letter in x:
list.append(letter)
length = int(len(list))
while len(combinations) < math.factorial(length):
y = random.shuffle(list)
if y not in combinations:
combinations.append(y)
print(combinations)