<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Homework
Step1:  Part 1
Step2:  Part 3
<ASSISTANT_TASK:>
Python Code:
import requests
import json 
file='US-Senators.json'
senators = requests.get('https://www.govtrack.us/api/v2/role?current=true&role_type=senator').json()['objects']
with open(file,'w') as f:
    f.write(json.dumps(senators))
    print(f"Saved: {file}")
Explanation: Homework: US Senator Lookup
The Problem
Let's write a program similar to this unit's End-To-End Example. Instead of European countries this program will provide a drop-down of US states. When a state is selected, the program should display the US senators for that state.
What information Should you display? Here is a sample of the 2 senators from the State of NY:
Sen. Charles “Chuck” Schumer [D-NY]
Senior Senator for New York
PARTY: Democrat
PHONE: 202-224-6542
WEBSITE: https://www.schumer.senate.gov
CONTACT: https://www.schumer.senate.gov/contact/email-chuck
## Sen. Kirsten Gillibrand [D-NY]
Junior Senator for New York
PARTY: Democrat
PHONE: 202-224-4451
WEBSITE: https://www.gillibrand.senate.gov
CONTACT: https://www.gillibrand.senate.gov/contact/email-me
HINTS:
Everything you will display for a senator can be found in the dictionary for that senator. Look at the keys available for a single senator as reference.
You will need to make a list of unqiue states from the senators.json file, similar to how to approaches the problem in last week's homework for product categories.
This Code will fetch the current US Senators from the web and save the results to a US-Senators.json file.
End of explanation
# Step 2: Write code here
Explanation: Part 1: Problem Analysis
Inputs:
TODO: Inputs
Outputs:
TODO: Outputs
Algorithm (Steps in Program):  
```
TODO:Steps Here
```
Part 2: Code Solution
You may write your code in several cells, but place the complete, final working copy of your code solution within this single cell below. Only the within this cell will be considered your solution. Any imports or user-defined functions should be copied into this cell.
End of explanation
# run this code to turn in your work!
from coursetools.submission import Submission
Submission().submit()
Explanation: Part 3: Questions
What are the advantages of using a dictionary for this information instead of a delimited file like in the previous homework?
--== Double-Click and Write Your Answer Below This Line ==--  
How easy would it be to write a similar program for World Leaders? Or College Professors? or NBA Players? What is different about each case?
--== Double-Click and Write Your Answer Below This Line ==--  
Explain your approach to figuring out which dictionary keys you needed to complete the program.
--== Double-Click and Write Your Answer Below This Line ==--  
Part 4: Reflection
Reflect upon your experience completing this assignment. This should be a personal narrative, in your own voice, and cite specifics relevant to the activity as to help the grader understand how you arrived at the code you submitted. Things to consider touching upon: Elaborate on the process itself. Did your original problem analysis work as designed?  How many iterations did you go through before you arrived at the solution? Where did you struggle along the way and how did you overcome it? What did you learn from completing the assignment? What do you need to work on to get better? What was most valuable and least valuable about this exercise? Do you have any suggestions for improvements?
To make a good reflection, you should journal your thoughts, questions and comments while you complete the exercise.
Keep your response to between 100 and 250 words.
--== Double-Click and Write Your Reflection Below Here ==--
End of explanation
<END_TASK>