.Remove isn't working correctly!
I'm making an Ai and i am trying to remove any words that are the Ai's name or a greeting! But it only removes the first it finds if even that, If someone knows what's going on i'd really appreciate some help. Oh and what_person_said_l_wt is user input tokenized in lowercase (using .lower), just so you know, Thanks here's my code:
Static_Greetings = ["hey","hi","hello"]
Name = ["jarvis"]
for word in what_person_said_l_wt:
if word in Static_Greetings or word in Name:
print (word)
what_person_said_l_wt.remove(word)
Results
input: hey jarvis what is the weather?
Modified: jarvis what is the weather
It does not remove both "Hey" and "Jarvis" to leave just the question: "what is the weather?" as it is supposed to!