\ Implement function find_key that takes a dictionary with int:int pairs and a second parameter which is...

50.1K

Verified Solution

Question

Programming

\

Implement function find_key that takes adictionary with int:int pairs and a second parameter which is anint that corresponds to one of the dictionary values, and returnsthe key that corresponds to this value. If there are more than onekeys, it returns the smallest key. If there is no key that maps tothis value, the functions returns False. You may not use the.values and .items methods. You may not create lists, tuples,strings, sets, dictionaries. You maynot use functions min, max,sorted.

Examples:

find_key({5:7, 6:3, 2:1, 3:4}, 4)->    3

find_key({1:9, 7:4, 6:3, 2:1, 8:4}, 4)   ->    7

find_key({9:5, 6:3, 2:1, 3:3}, 4)      ->    False

True

False

In python Please

Answer & Explanation Solved by verified expert
4.1 Ratings (613 Votes)
def    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students