This is a snippet of my code, I'm trying to make a scrabble type game but for some reason this if statement isn't working. The file I'm opening is a list of 238,000 words, the English dictionary, and tempword is predefined by an input which is passed over to this function. So here I'm trying to have the tempword compared to every word in the file, but when it runs through it doesn't add to the tally even though I know that word is in the list. Any thoughts?
def checkvalidword(tempword):
tally = 0
file = open("words.txt")
for x in file:
if x == tempword:
tally+=1
print("Added to the tally")