The task is to create a script that uses the requests library toquery the Propublica API to retrieve information about members ofCongress, and then uses the matplotlib library to create avisualization of information calculated from the data pulled fromPropublica. Specifically, your tool should:
- Pull the list of members for each available Congress;
- Calculate their respective ages at the beginning of eachCongressional session for which there is data, currently the 102ndto the 116th Congress;
- Use these age figures to calculate the average age of themembers of each Congress;
- Plot the trend over time using matplotlib (average age bysession);
- As an optional bonus exercise, plot separate lines for Houseand Senate.
NOTE: For the purpose of this assignment we can use Jan. 1 ofthe year the session began to approximate the age figures. Forexample, the current Congress is the 116th, which began on2019-01-03, but for calculating ages you can use 2019-01-01.
language: Python
Expert Answer
Answer to The task is to create a script that uses the requests library to query the Propublica API to retrieve information about …