Skip to content

Instantly share code, notes, and snippets.

@glad1couldkek
Created October 4, 2016 20:39
Show Gist options
  • Select an option

  • Save glad1couldkek/826bbdb17ba1f3854e179269f7c2f448 to your computer and use it in GitHub Desktop.

Select an option

Save glad1couldkek/826bbdb17ba1f3854e179269f7c2f448 to your computer and use it in GitHub Desktop.
def find_anagrams(words, new_word):
for word in words:
first = [x for x in word]
second = [x for x in new_word]
if len(word) == len(new_word):
for i in first:
for j in second:
if i != j:
break
else:
print(word)
find_anagrams(["spare", "hello", "pears", "world", "reaps"], "parse")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment