+ 1

Guys help me code a program in python which takes in a set of letters and gives output with as many english words as possible

A python program that takes in letters for eg. a,a,b,c,d,m,m,m,l. The program should create as many permutations ranging from size 3 to 9. It should compare those words with the English language to verify if it's a legit english word. So the output basically should be Bad, dab, cab, mammal, lab, lad (whatever) I'm not a good coder at all so this is eating my brain cells. I've been reading reddits and others for a combination. I thought I should be asking here. We seriously have awesome coders in here. So please help me folks. Relieve me from this suffering and I assure you I'll resurrect as a sensible coder soon. Thanks. Happy Easter in advance!!

20th Apr 2019, 5:27 AM
Akhil Padmanabhan
Akhil Padmanabhan - avatar
5 ответов
+ 1
If youre planning on searching through a real dictionary, youll need an api for it. 1) alternatively, for testing purposes you could make your own dictionary dictionaryArr[]. 2) secondly, youll also need a letterArr[]. 3) third, you need a generated words array genWordsArr[] 4) generate an array of 3 letter words from the letterArr with nested loops. 5) finally, you could check the LibraryArr against the genWordsArr with a loop nested with if statements to check for a match This is only a blueprint so if youve covered your fundamentals it will make sense. it is also how i would tackle it, but ohers may have a different approach?
20th Apr 2019, 10:52 PM
Logomonic Learning
Logomonic Learning - avatar
+ 1
Ok.. trust me I didn't get it. After this reply I completed the python course to make the entire course available for reference from this reply. I did a program for phase 1 of the problem. But comparing the result with a dictionary to sort only the English words is what I couldn't. And also to set the size of the words like from 3 letter word to 9 letter word. from itertools import permutations perms = [''.join(p) for p in permutations ('abcdmmmal')] print(perms)
23rd Apr 2019, 3:26 AM
Akhil Padmanabhan
Akhil Padmanabhan - avatar
+ 1
its always a good idea to break a task down into stages, so for now just concentrate on making three letter words. if you can successfully do that you can increment the number of letters as you like. in regards to the word, im sure it is expected that the words can be created in any order, rather than the order the letters appear in the array. e.g. mal (even though ‘a’ starts first), so you will need a random function in addition to a while loop to ensure that the index of the letter of the array only appears once.
23rd Apr 2019, 7:57 PM
Logomonic Learning
Logomonic Learning - avatar
+ 1
perhaps D'Lite could help you out
23rd Apr 2019, 8:18 PM
Logomonic Learning
Logomonic Learning - avatar
0
Well thank you guys i was successful with the program i have also posted it. Kindly go to my profile and see the code. Thanks again
26th Apr 2019, 11:42 AM
Akhil Padmanabhan
Akhil Padmanabhan - avatar