I want to make a grammar checker with Python. But this is not going to be a standard grammar checker. This is intended for learners of the English language who are at the beginner level. I wrote the following code to check if the user uses the correct form of the verb:
preList = ['came', 'waited', 'sat', 'stood', 'went', 'left']
sentence = input("Type a sentence using the past simple tense: ")
sentence = sentence.split()
if sentence[1] or sentence[2] or sentence[3] in preList:
print("Looks good!")
else:
print("Maybe you're missing something!")
The problem I have is that even if the user input does not contain any of the words in preList, it prints "Looks good". What is the problem with my code?
Correct the if-clause to
if sentence[1] in preList or sentence[2] in preList or sentence[3] in preList: