Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Programming Exercises 157 THON 18. Restaurant Selector You have a group of frien

ID: 3590281 • Letter: P

Question

Programming Exercises 157 THON 18. Restaurant Selector You have a group of friends coming to visit for your high school reunion, and you want to take them out to eat at a local restaurant. You aren't sure if any of them have dietary restrictions, but your restaurant choices are as follows: Joe's Gourmet Burgers-Vegetarian: No, Vegan: No, Gluten-Free: No Main Street Pizza Company-Vegetarian: Yes, Vegan: No, Gluten-Free: Yes Corner Café-Vegetarian: Yes, Vegan: Yes, Gluten-Free: Yes Mama's Fine Italian-Vegetarian: Yes, Vegan: No, Gluten-Free: No The Chef's Kitchen-Vegetarian: Yes, Vegan: Yes, Gluten-Free: Yes Programing , Processing tion Structur etion Write a program that asks whether any members of your party are vegetarian, vegan, or gluten-free, to which then displays only the restaurants to which you may take the group ctons and ample of the program'so and Tuples eAbcut Slrings anaries and eses and Is anyone in your party a vegetarian? yes Enter Is anyone in your party a vegan? no Enter Is anyone in your party gluten-free? yes Enter Here are your restaurant choices Programming curslcn Main Street Pizza Company Corner Cafe The Chef's Kitchen e here to search

Explanation / Answer

'''
The restaurant list has been created as list of list.Every element is a
list with name vegetatrian,vegan and gluten free as attributes
'''

list = [["Joe's Gourmet Burgers","no", "no","no"],
        ["Main Street Pizza Company","yes", "no","yes"],
        ["Corner Cafe","yes", "yes","yes"],
        ["Mama's Fine Italian","yes", "no","no"],
        ["The Chef's Kitchen","yes", "yes","yes"]]

count = 0
inp1 = input("Is anyone in your party a vegetarian?(yes/no)")
if inp1=="yes":
   count = count + 1
inp2 = input("Is anyone in your party a vegan?(yes/no)")
if inp2=="yes":
   count = count + 1
inp3 = input("Is anyone in your party a gluten-free?(yes/no)")
if inp3=="yes":
   count = count + 1

choice = []
for i in range(len(list)):
      found = 0
      if inp1 == "yes":
         if list[i][1] == inp1:
            found = found + 1
      if inp2 == "yes":
         if list[i][2] == inp2:
            found = found + 1
      if inp3 == "yes":
         if list[i][3] == inp3:
            found = found + 1
      if count == found:
         choice.append(list[i][0])

if len(choice) > 0:
   print("Here are your restaurant choices:")
   for i in range(len(choice)):
        print(choice[i])
else:
   print("None of the resaturant seems applicable")