Python Virtual Assistant Code

def core_code():
# First, we will call greeting
# to mark the starting
greeting()
# Infinite loop until certain conditions
# are met
while (True):
# changing the query to lowercase
# ensures it works most of the time
phrase = audioinput().lower()
if "open medium" in phrase:
assistant("Opening Medium.com")
# the function reaches out to the
# default browser
webbrowser.open("www.medium.com")
continue
elif "open google" in phrase:
assistant("Opening Google ")
webbrowser.open("www.google.com")
continue
elif "what day it is" in phrase:
theDay()
continue
elif "what time it is" in phrase:
theTime()
continue
# trigger/condition to exit the program
elif "bye" in phrase:
assistant("Exiting. Have a Good Day")
exit()
elif "from wikipedia" in phrase:
# to pull information from Wiki
assistant("Checking the wikipedia ")
phrase = phrase.replace("wikipedia", "")
# it will limit the summary to four lines
result = wikipedia.summary(phrase, sentences=4)
assistant("As per wikipedia")
assistant(result)
elif "what is your name" in phrase:
assistant("I am your nameless virtual assistant")
if __name__ == '__main__':
# to pull the core code
# and execute it
core_code()
Stefan Agudaru