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

def read_words(fname):
	infile=open(fname)
	temp=infile.read() # temporary variable, dynamic type is string
	infile.close()
	return temp.split('\n')[:-1]

def main():
	wlist=read_words('words.txt')
	ustr=raw_input('String: ')
	
	flag=False
	k=0
	while k<len(wlist):
		if wlist[k]==ustr:
			flag=True
			break
		k+=1 # there is no plus-plus operator

	if flag:
		print 'Yes, %s is a word.  In fact, it\'s in slot %d.' % (ustr,k)
	else:
		print 'No, %s is not a word.' % (ustr)

if __name__=='__main__': # only matters if you're importing this module
	main()

#
# Notes
# -----
# This version uses a while-loop and functions.  Ask about while-else.
#

