Hi, I need somone to help me write a program in python 3.6 for question number 1
ID: 3871712 • Letter: H
Question
Hi,
I need somone to help me write a program in python 3.6 for question number 18.
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 searchExplanation / Answer
# Create a list of restaurants
restaurantList=["Joe's Gourmet Burgers","Main Street Pizza Company", "Corner Cafe","Mama's Fine Italian", "The Chef's Kitchen"]
# List of vegetarian restaurants
vegetarianList=["Main Street Pizza Company", "Corner Cafe","Mama's Fine Italian", "The Chef's Kitchen"]
# List of Vegan Restaurants
veganList=["Corner Cafe", "The Chef's Kitchen"]
# List of Gluten Free Restaulrants
glutenFreeList=["Main Street Pizza Company", "Corner Cafe", "The Chef's Kitchen"]
# Now get input from user
vegOption = input ('Is anyone in your party a vegetarian?')
# initailize resultList as full list of restaurants
resultList = restaurantList
# resultList is intersection of resultList and vegetarian restaurants
if vegOption.lower() == "yes":
resultList = list(set(restaurantList) & set(vegetarianList))
veganOption = input ('Is anyone in your party a vegen?')
# resultList is intersection of resultList and vegan restaurants
if veganOption.lower() == "yes":
resultList = list(set(resultList) & set(veganList))
glutenOption = input ('Is anyone in your party gluten-gree?')
# resultList is intersection of resultList and gluten free restaurants
if glutenOption.lower() == "yes":
resultList = list(set(resultList) & set(glutenFreeList))
# print out the final resultList
print(resultList)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.