Skip to content

Instantly share code, notes, and snippets.

@quincynyan
Created January 6, 2023 14:04
Show Gist options
  • Save quincynyan/8801ff4d541f3f7f25d17c19b92fe142 to your computer and use it in GitHub Desktop.
Save quincynyan/8801ff4d541f3f7f25d17c19b92fe142 to your computer and use it in GitHub Desktop.
Anagrams
test_list = ['lump', 'eat', 'em', 'tea', 'me', 'plum']
for ele in test_list:
num = 0
for ele2 in test_list:
if sorted(ele) == sorted(ele2):
num += 1
print(ele, "has", num, "anagrams")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment