You have a group of friends coming to visit you 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: Yes

Main Street Pizza Company-Vegetarian: Yes, Vegan: Yes, Gluten-Free: Yes

Corner Cafe-Vegetarian: Yes, Vegan: No, Gluten-Free: Yes

Mama's Fine Italian-Vegetarian: Yes, Vegan: No, Gluten-Free: No

The Che'fs Kitchen-Vegetarian: Yes, Vegan: Yes, Gluten-Free: Yes

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.

Respuesta :

Answer:

Python code is explained below

Explanation:

def RestaurentSelector():

               #stroring the restaurants data

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

               #taking the requirements for party

               isVeg=input("Is anyone at your party a vegetarian? ")

               isVegan=input("Is anyone at your party a vegan? ")

               isGF=input("Is anyone at your party a gluten-free? ")

               #printing the info

               print("Hera are your restaurant choices :")

               #loop to check each restaurent

               for x in restaurents:

                               #checking for veg requirement

                               if isVeg=="yes" and x[1]=="no":

                                               #skipping the current restaurent if is satisfying

                                               continue

                               #checking for vegan requirement

                               if isVegan=="yes" and x[2]=="no":

                                               #skipping the current restaurent if is satisfying

                                               continue

                               #checking for glutan free requirement

                               if isGF=="yes" and x[3]=="no":

                                               #skipping the current restaurent if is satisfying

                                               continue

                               #if all requirementws are satisfied

                               #printing the restaurent name

                               print("\t",x[0])

               #exiting the function\

#calling the function

RestaurentSelector()