subject

#write a function called rabbit_hole. rabbit_hole should have#two parameters: a dictionary and a string. the string may be#a key to the dictionary. the value associated with that key,#in turn, may be another key to the dictionary.##keep looking up the keys until you reach a key that has no#associated value. then, return that key.##for example, imagine if you had the following dictionary.#this one is sorted to make this example easier to follow: ## d = {"bat": "pig", "pig": "cat", "cat": "dog", "dog": "ant",# "cow": "bee", "bee": "elk", "elk": "fly", "ewe": "cod",# "cod": "hen", "hog": "fox", "fox": "jay", "jay": "doe",# "rat": "ram", "ram": "rat"}##if we called rabbit_hole(d, "bat"), then our code ## - look up "bat", and find "pig"# - look up "pig", and find "cat"# - look up "cat", and find "dog"# - look up "dog", and find "ant"# - look up "ant", and find no associated value, and so it would# return "ant".##other possible results are: ## rabbit_hole(d, "bat") -> "fly"# rabbit_hole(d, "ewe") -> "hen"# rabbit_hole(d, "jay") -> "doe"# rabbit_hole(d, "yak") -> "yak"##notice that if the initial string passed in is not a key in#the dictionary, that string should be returned as the result as#well.##note, however, that it is possible to get into a loop. in the#dictionary above, rabbit_hole(d, "rat") would infinitely go#around between "rat" and "ram". you should prevent this: if a#key is ever accessed more than once (meaning a loop has been#reached), return the boolean false.##hint: if you try to access a value from a dictionary that does#not exist, a keyerror will be raised

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 15:00
Marissa is a high school student who wants to be a hydroelectric production manager. she talks to her guidance counselor about her education path, and the counselor says that she needs to get an associate’s degree from a four-year college and will follow that with significant on-the-job training. what error did the counselor make while advising marissa? marissa will not have on-the-job training. marissa also needs a three-year apprenticeship. marissa only needs to attend a two-year college. marissa needs a bachelor’s degree.
Answers: 1
question
Computers and Technology, 22.06.2019 02:30
If you turn on the lock alpha button , what happens
Answers: 1
question
Computers and Technology, 22.06.2019 03:10
Write a program that begins by reading in a series of positive integers on a single line of input and then computes and prints the product of those integers. integers are accepted and multiplied until the user enters an integer less than 1. this final number is not part of the product. then, the program prints the product. if the first entered number is negative or 0, the program must print “bad input.” and terminate immediately. next, the program determines and prints the prime factorization of the product, listing the factors in increasing order. if a prime number is not a factor of the product, then it must not appear in the factorization. sample runs are given below. note that if the power of a prime is 1, then that 1 must appear in t
Answers: 3
question
Computers and Technology, 23.06.2019 09:30
You wanted to look up information about alzheimer's, but you were unsure if it was spelled "alsheimer's" or "alzheimer's." which advanced search strategy would be useful? a) a boolean search b) using a wild card in your search c) trying different search engines d) doing a search for "alsheimer's not alzheimer's" asap. ill give brainlist.
Answers: 1
You know the right answer?
#write a function called rabbit_hole. rabbit_hole should have#two parameters: a dictionary and a st...
Questions
question
History, 28.08.2019 15:30
question
Mathematics, 28.08.2019 15:30
question
Advanced Placement (AP), 28.08.2019 15:30
Questions on the website: 13722360