I'm trying to output a specific answer based on the users input, the code works now, but only for one word answers. Im trying to achieve the same output but the user must enter a full sentence containing the assigned words. Keep in mind I have to use the split()
function.
My code:
def welcome():
print('Welcome to the automated technical support system.')
print('Please describe your problem.')
# *************************************
def get_input():
return input().lower()
# *************************************
def main():
welcome()
while True:
query = get_input()
if query == 'crashed':
print("Are the drivers up to date?")
elif query == 'blue':
print("Ah, the blue screen of death. And then what happened?")
elif query == 'hacked':
print("You should consider installing anti-virus software.")
elif query == 'bluetooth':
print("Have you tried mouthwash?")
elif query == 'windows':
print("Ah, i think i see your problem. What version?")
elif query == 'apple':
print("You do mean the computer kind?")
elif query == 'spam':
print("You Should see if your mail client can filter")
elif query == 'connection':
print("Contact Telkom.")
elif not query=='quit':
print('Curious, tell me more.')
elif query == 'quit':
break
main()
# *************************************
Sample Output:
Welcome to the automated technical support system.
Please describe your problem.
>>crashed
Are the drivers up to date?
>>yes
Curious, tell me more.
Output I need:
Welcome to the automated technical support system.
Please describe your problem.
>> my pc crashed
Are the drivers up to date?
>>yes
Curious, tell me more.