Question: CODE MUST BE IN PYTHON) Write a second function called getvalue(jsonlist, key) that accepts two arguments: a 2D JSON list in the format returned by
CODE MUST BE IN PYTHON) Write a second function called getvalue(jsonlist, key) that accepts two arguments: a 2D JSON list in the format returned by the function in Problem 1([ [firstname, dave], [lastname, mckenney], [position, instructor] ] ), and a string/key specifying the key you want to retrieve the value for. This function should iterate through the list to find the matching key and return the corresponding value. If no items within the given list match (i.e., the key does not exist), the function should return an empty string. As an example, if you saved the list into a variable called mylist, the output of the getvalue function would be:
getvalue(mylist, firstname) = dave
getvalue(mylist, lastname) = mckenney
getvalue(mylist, position) = instructor
getvalue(mylist, height) =
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
