Answer:
The solution code is written in Python:
Explanation:
Firstly, we create a variable capitals_dict and initialize it with a empty dictionary (Line 3).
Next, we use the for-loop to traverse through each tuple item in the state_capitals list (Line 5). Within the loop, we use the syntax x[0] to take out the first item (state) from the tuple and use it as the key capitals_dict[x[0]]. We use the syntax x[1] to take out the second item (capital) from the tuple and set it as the value of the dictionary (capitals_dict[x[0]].). (Line 6)
When finishing the loop, we can print the dictionary (Line 7) and the output is as follows:
{'Michigan': 'Lansing', 'Massachusetts': 'Boston', 'Pennsylvania': 'Harrisburg', 'New York': 'Albany'}