Checking If Word Is English Python
<p>So, I am doing a project where I have a list with english words and want it to check the word i write is in the list and tell me if it's in english or not, I have no idea how to do this but It's what i'm supposed to do so I am asking for your help</p>

<pre><code>text = open("dict.txt","r")
#Opens the dict.txt file I have and reads it

word = input("Type a word to check if it's english.")
#Type in a word to check if is english or not

if(word in text == true):
print(word, "Is in English.")
elif(word in text == false):
print(word, "Is not in English.")
#Check if word is true or false in the dict.txt and print if it is english or not.
</code></pre>

<p>In your code, <code>text</code> is a file object, which you first need to read from somehow. You could, for example, read them into a set (because of O(1) lookup times):</p>

<pre><code>with open("dict.txt", "r") as f:
    text = {line.strip() for line in f}  # set comprehension

word = input("Type a word to check if it's english.")
if word in text:
    print(word, "Is in English.")
else:
    print(word, "Is not in English.")
</code></pre>

<p>As someone with a background in NLP: Trying to <em>actually</em> test whether a word is valid English is more complicated than you might think. With a big enough dictionary (that also contains inflected forms) you should have a high accuracy though.</p>

python list