Question: 1. Design an algorithm for reverse lookup in a dictionary. The inputs should be a dictionary object and a single value that may for may

 1. Design an algorithm for reverse lookup in a dictionary. The

1. Design an algorithm for reverse lookup in a dictionary. The inputs should be a dictionary object and a single value that may for may not) be stored in that object. The algorithm will search the dictionary for the given value and return the associated key of the first occurance if the valus is found. If the value is not found, the algorithm should return the None valus. Document your design for this algorithm in a flowchart and submit it as homework10_fc.pdf. 2. Using your flowchart design mpernent a function reverse value is not in the dictionary, retun None For Example >my-dictionary one:1, "two 2, seven:7) >print reverse_lookupmy_dictionary.7 lookup that takes in a dictionary ana a value as arguments. Your function will find and return the key associated with the rst occurrence o the valve argument it is found f th Hint: Try iterating through the dictionary using a for loop and comparing each key-value pair to the valus you're looking for. Ramember, there are ways to s88 the key AND value of a dictionary when using a for loop 3. Define a function generate_kv_strings that takes in a dictionary as the argument. Your function will iterate through the dictionary to create then return a list of strings representing each key-value pair from the dictionary, where each string will be in the format "key: value" where key and value are the respective keys and values from the given dictionaryl. For Example >>>my-new.oictionary = ("NC":"North Carolina'. "SC':'South Caroline'l >print generate_kv_stringsmy-new dictionaryl INC: North Carolina, "SC: South Carolinal Hint: A ist comprehension can make this function much shorter, but you are not required to use one. Hint: Remember that you need to convert each key and velue into a str before concatenating them, in case they are of a different type

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!