wordfile = open('/usr/share/dict/words', 'r')words = wordfile.readlines()wordfile.close()length = int(raw_input("How many letters is it? "))words = [word.strip() for word in words if len(word.strip()) == length]print str(len(words)) + ' possibilities'firstletter = raw_input("What is the first letter? ")words = [word for word in words if word.upper().startswith(firstletter.upper())]print str(len(words)) + ' possibilities'lastletter = raw_input("What is the last letter? ")words = [word for word in words if word.upper().endswith(lastletter.upper())]print str(len(words)) + ' possibilities'beaten = Falsefor i in range(10): answer = raw_input( 'is the word ' + words[i] + '? ') if answer.lower().strip().startswith("y"): print "You win!" beaten = True breakif not beaten: print "HA! Told you I was smart!"