Answer:
The program in python is as follows:
def checkstatus(food,foodlists):
if food in foodlists:
return "Available"
else:
return "Not Available"
foodlists = ["Burger","Spaghetti","Potato","Lasagna","Chicken"]
for i in range(len(foodlists)):
foodlists[i] = foodlists[i]. lower()
food = input("Food (Q to quit): ").lower()
while food != "q":
print("Status: ",checkstatus(food,foodlists))
food = input("Food (Q to quit): ").lower()
Step-by-step explanation:
The program uses function.
The function is defines here. It accepts as input, a food item and a food list
def checkstatus(food,foodlists):
This check if the food is in the food lists
if food in foodlists:
Returns available, if true
return "Available"
Returns Not available, if otherwise
else:
return "Not Available"
The main begins here.
The food list is not given in the question. So, I assumed the following list
foodlists = ["Burger","Spaghetti","Potato","Lasagna","Chicken"]
This converts all items of the food list to lowercase
for i in range(len(foodlists)):
foodlists[i] = foodlists[i]. lower()
Prompt the user for food. When user inputs Q or q, the program exits
food = input("Food (Q to quit): ").lower()
This is repeated until the user quits
while food != "q":
Check and print the status of the food
print("Status: ",checkstatus(food,foodlists))
Prompt the user for another food
food = input("Food (Q to quit): ").lower()