I have created a function to find the longest word in a text file and finding the longest word(s) in a text file that can be made from 9 letters. I'm new to python and I'm creating a game similar to countdown.
I've created a function to find the longest word in the text file. What I want now is to create python code to find the longest word(s) that can be formed from the 9 letters.
Each letter can only be used once. So from 'qugteroda', I should get rag outed, outraged, out dare, out read, outrage,readout. I'm using python 2.2
def Words():
qfile=open('dict.txt','r')
longg=''
for line in qfile:
if len(line)>len(longg):
longg=line
return longg