Question: (Python) Anyone can tell me what is wrong with my first function? and tell me how to write the second function? Thanks! 1. Define a
(Python) Anyone can tell me what is wrong with my first function? and tell me how to write the second function? Thanks!

1. Define a function reverse_lookup that takes in a dictionary and a value. Your function will find and return a key associated with with the inputted value if one exists. If the value is not in the dictionary, return None. Hint: Try iterating through the dictionary using a for loop and comparing each key-value pair to the value you're looking for. Remember, there are ways to see the key AND value of a dictionary when using a for loop. 2. 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 dictionary). Hint: A list 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 value 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
Get step-by-step solutions from verified subject matter experts
