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

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!