subject

Write a function called no_you_pick. no_you_pick should have two parameters. The first parameter is a dictionary where the keys are restaurant names and the values are lists of attributes of those restaurants as strings, such as "vegetarian", "vegan", and "gluten-free". #
#The second parameter is a list of strings representing of necessary attributes of the restaurant you select.
#
#Return a list of restaurants from the dictionary who each contain all the diet restrictions listed in the list, sorted alphabetically. If there are no restaurants that meet all the restrictions, return the string
#"Sorry, no restaurants meet your restrictions". Types of diet restrictions that exist in this question's universe are: vegetarian, vegan, kosher, gluten-free, dairy-free
#
#For example:
#grading_scale = {"blossom": ["vegetarian", "vegan", "kosher", "gluten-free", "dairy-free"], \
# "jacob's pickles": ["vegetarian", "gluten-free"], \
# "sweetgreen": ["vegetarian", "vegan", "gluten-free", "kosher"]}
#guests_diet = ["dairy-free"]
#no_you_pick(grading_scale, guests_diet) -> ["blossom"]

#Write your code here!
def no_you_pick(restaurants, preferred_diet):
result = []
for i in preferred_diet:
for key, value in restaurants. items():
# print(value)
if i in value:
result. append(key)
result. sort()
return result
return "Sorry, no restaurants meet your restrictions"

#Below are some lines of code that will test your function.
#You can change the value of the variable(s) to test your
#function with different inputs.
#
#If your function works correctly, this will originally
#print: blossom
grading_scale = {"blossom": ["vegetarian", "vegan", "kosher", "gluten-free", "dairy-free"], \
"jacob's pickles": ["vegetarian", "gluten-free"], \
"sweetgreen": ["vegetarian", "vegan", "gluten-free", "kosher"]}
guests_diet = ["dairy-free"]
print(no_you_pick(grading_scale, guests_diet))
**My code doesn't seem to work, any help with it I'll really appreciate it!**

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 17:20
The thickness of a part is to have an upper specification of 0.925 and a lower specification of 0.870 mm. the average of the process is currently 0.917 with a standard deviation of 0.005. determine the percentage of product above 0.93 mm.
Answers: 3
question
Computers and Technology, 22.06.2019 21:00
Simon says is a memory game where "simon" outputs a sequence of 10 characters (r, g, b, y) and the user must repeat the sequence. create a for loop that compares the two strings starting from index 0. for each match, add one point to userscore. upon a mismatch, exit the loop using a break statement. assume simonpattern and userpattern are always the same length. ex: the following patterns yield a userscore of 4: simonpattern: rrgbryybgy userpattern: rrgbbrybgy
Answers: 2
question
Computers and Technology, 23.06.2019 14:30
Which of the following would not be considered a pc? a. mainframe b. desktop c. tablet pc d. laptop
Answers: 2
question
Computers and Technology, 23.06.2019 17:00
What does the faves button do? a. users mark a web page as a favorite b. leads other readers to favor a specific page c. readers sort and align their favicons, or favorite icons d. leads users to a message board where they can post questions
Answers: 1
You know the right answer?
Write a function called no_you_pick. no_you_pick should have two parameters. The first parameter is...
Questions
question
Chemistry, 22.08.2019 13:30
question
Social Studies, 22.08.2019 13:30
question
Biology, 22.08.2019 13:30
question
Chemistry, 22.08.2019 13:30
Questions on the website: 13722367