# Spell checker, Version 1.0 # Input: Dictionary of six-letter words and a string entered by the user # Process: determine if the user's string is a word in the dictionary # Output: Indicate YES or NO #wlist = open('wordsShort.txt').read().split('\n')[:-1] #[:-1] everything but # the last in the list infile = open("wordsShort.txt") wlist=[] word = infile.readline() while word: wlist.append(word[0:len(word)-1]) # strip off the last character, end of line '\n' word=infile.readline() infile.close() print 'Wlist = %s' % wlist str = raw_input('Enter a string: ') if str in wlist: print "Yes, %s is a word in the list." % (str) else: print "No, %s is not a word in the list." % (str)