Does anyone know how to make python auto stop if you put something in?

This is my code.
grocery_list =["ham","carrots","apples","chips","bread","milk","candy"]
print("welcome to your virtaul grocery list!")
print("The first item on the list is ham")
print("Here's the list.")
question = input("Do you have ham? ")
if (question =='yes'):print("ok!")
elif (question == 'no'):print("cmon,get it! ok,NOW we can continue.")
else :
print("THE SYSTE<SM HAAAS>> NSOWE BE))(N BRO(^$#KEN.") right here I need to tell it to stop printing here if they say something other than yes or no.

You are viewing a single comment. View All
Answered by OldWizard209 [earned 5 cycles]
View Answer

yes, just typing exit() will make the code stop if it hits that point. @SnowpawValdez