#
# Torbert, 8.20.2008
#
# Spell-checker, Version 1.1
#
#   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
#

infile=open('words.txt')
wlist=infile.read().split('\n')[:-1]
infile.close()

ustr=raw_input('String: ')

flag=False
for w in wlist: # iterates over the elements of a collection
	if w==ustr:
		flag=True
		break

if flag:
	print 'Yes, %s is a word.' % (ustr) # mods a string by a tuple
else:
	print 'No, %s is not a word.' % (ustr)

#
# Notes
# -----
# This version uses a boolean variable and a for-loop to determine list
# membership.  The Python for-loop is like Java's iterator for-loop and
# there is no traditional C-style for-loop in Python.
#

