Expanding on what Bruna asked:
Is writing if statements every step of the way within the coffee chatbot the only way to accomplish this?
stopWords = ['stop', 'Stop', 'cancel', 'Cancel', 'quit', 'Quit']
res = input('What size drink can I get for you? \n[a] Small \n[b] Medium \n[c] Large \n> ')
if res == 'a':
elif res == 'b':
elif res == 'c':
elif res in stopWords:
And then insert similar
elif statements for all the inner functions (
Or is it possible to write a specific yet broader function that sort of “runs in the background” while the bot is being executed so it could detect if the user inputs any of the “stop words”?
The only idea I have had for this up to this point is to write another function - within which I would then house the coffee chatbot - and somehow leverage a boolian and a while loop so it would, as I mentioned, run “in the background” and get activated if any of the stop words were inputted; however, I have not figured out how to actually write the darn thing.
Any and all help would be much appreciated.