How do you generate anagrams in alphabetical order in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do you generate anagrams in alphabetical order in python?

my friend needs to make a program called anagramsearch.py that searches a file for angrams of a given word, printing the results in alphabetical order. any advice on how to go about that?

16th May 2018, 3:51 PM
Amadeus
Amadeus - avatar
7 Answers
0
Can be quite complex. Are there any further rules, e.g. just all possible permutations of a word or does the output have to be some other existing word or phrase? Sorry just re-read the post and found the answers.
16th May 2018, 4:51 PM
Marco Polidori
Marco Polidori - avatar
0
what did you find?
16th May 2018, 5:03 PM
Amadeus
Amadeus - avatar
16th May 2018, 6:37 PM
Marco Polidori
Marco Polidori - avatar
0
Basically you could permutate the word as input and convert the data from the file as dict or list and check if the permutations are in the list, creating a new sorted list (will be alphabetical).
16th May 2018, 6:39 PM
Marco Polidori
Marco Polidori - avatar
0
thanks for the tip Marco, confused about the link though
16th May 2018, 6:41 PM
Amadeus
Amadeus - avatar
0
Look into the source codes, there are examples for permutations and anagram testing
16th May 2018, 8:01 PM
Marco Polidori
Marco Polidori - avatar
0
Thanks a bunch dude
16th May 2018, 8:19 PM
Amadeus
Amadeus - avatar