I'm new to Python and trying to make a sort of "Assistant" to get the hang of the language. The elif always starts if the if statement isn't satisfied, any idea how to fix it?
I already tried to change to all if, it didn't work.
import wikipedia
def getSummaryFromWikipedia(command):
return wikipedia.summary(command, sentences=1)
def loopTest():
command = input("Command: ")
if "how to" in command:
googleSearch(command)
elif "who is" or "who was" in command:
say(getSummaryFromWikipedia(command))
else:
print("Command not yet implemented.")
I want to set it up so that if "How to ..." is in the input it starts a google search, if there is "who is" or "who was" in the input to look it up on wikipedia and if none of the conditions are satisfied it just says that the command is not yet implemented. The problem is that if the first two if are satisfied the program works as intended, if I use some random word to try and get the else to work it just gives me wikipedia suggestions and some errors: "...\AppData\Local\Programs\Python\Python37\lib\site-packages\wikipedia\wikipedia.py:389: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("html.parser"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently."