(Solved) : Variable Tabledata Represents Data Might Appear Table Spreadsheet First List Contains Colu Q44156256 . . .
The variable table_data below represents data as it might appearin a table or spreadsheet. The first list contains column names andthe rest of the lists are rows of data. Write a functionconvert_table that converts the data in a nested list liketable_data to a list of dictionaries that matches the output below.Your function should work for any list formatted like table_data,meaning it should always use the first list given as the keys andthe rest of the lists as values.
For example:
table_data = [ [“first_name”, “last_name”, “city”, “state”],[“Elisabeth”, “Gardenar”, “Toledo”, “OH”], [“Jamaal”, “Du”,”Sylvania”, “OH”], [“Kathlyn”, “Lavoie”, “Maumee”, “OH”] ]convert_table(table_data) # The return is below [ {“first_name”:”Elisabeth”, “last_name”: “Gardenar”, “city”: “Toledo”, “state”:”OH”}, {“first_name”: “Jamaal”, “last_name”: “Du”, “city”:”Sylvania”, “state”: “OH”}, {“first_name”: “Kathlyn”, “last_name”:”Lavoie”, “city”: “Maumee”, “state”: “OH”}
Expert Answer
Answer to The variable table_data below represents data as it might appear in a table or spreadsheet. The first list contains colu…
OR