So im making a anagram detector that reads all the words in a string.
I already have the anagram funktion working (returning true if it is a anagram, and false otherwise)
But i am having trouble making a loop that reads all the words in the string, and returning the anagram words.
For now i have, where "is_anagram()" is the funktion telling if 2 words are anagrams or not.
def anagram_solver(string_of_words):
word_list = string_of_words.split()
index1 = 0
index2 = 1
anagram_liste = []
for word in word_list:
print(word)
if is_anagram(word, word_list[0]):
anagram_liste.append(word)
index1 +=1
else:
index1 += 1
return anagram_liste
print(anagram_solver('halb mojn bhal njom ff albh whats'))
A little hint on how to proceed?