The Checklist
In your compciv-2016 Git repository create a subfolder and name it:
exercises/0014-sunlight-congress-csv
The folder structure will look like this (not including any subfolders such as `tempdata/`:
compciv-2016 └── exercises └── 0014-sunlight-congress-csv ├── a.py ├── b.py ├── c.py ├── d.py ├── e.py ├── f.py
a.py
|
0.5 points | Download the Sunlight Foundation's CSV of Congress legislators |
b.py
|
0.5 points | TK |
c.py
|
0.5 points | TK |
d.py
|
0.5 points | TK |
e.py
|
0.5 points | TK |
f.py
|
0.5 points | TK |
Background information
The file can be found here: http://stash.compciv.org/congress/2016-01/sunlight-legislators.csv
a. Download the spreadsheet, count how many lines b. Print the number of Republicans, Democrats, and Independents ('set') c. Print the names of the 5 oldest and the 5 youngest legislators d. Print the number of men and women who are active legislators e. Count up the men and women, by party, by chamber f. List all states that do not have at least one woman legislator right now.
The Exercises
0014-sunlight-congress-csv/a.py » Download the Sunlight Foundation's CSV of Congress legislators
- Make a tempdata subdirectory inside this working directory.
- Download the Sunlight legislators CSV file
- Count the lines and print the number
The file can be found here:
http://stash.compciv.org/congress/2016-01/sunlight-legislators.csv
When you run a.py
from the command-line:
0014-sunlight-congress-csv $ python a.py
-
The program's output to screen should be:
There are 898 lines in tempdata/sunlight-legislators.csv
0014-sunlight-congress-csv/b.py » TK
TK
When you run b.py
from the command-line:
0014-sunlight-congress-csv $ python b.py
-
The program's output to screen should be:
TK
0014-sunlight-congress-csv/c.py » TK
TK
When you run c.py
from the command-line:
0014-sunlight-congress-csv $ python c.py
-
The program's output to screen should be:
TK
0014-sunlight-congress-csv/d.py » TK
TK
When you run d.py
from the command-line:
0014-sunlight-congress-csv $ python d.py
-
The program's output to screen should be:
TK
0014-sunlight-congress-csv/e.py » TK
TK
When you run e.py
from the command-line:
0014-sunlight-congress-csv $ python e.py
-
The program's output to screen should be:
TK
0014-sunlight-congress-csv/f.py » TK
TK
When you run f.py
from the command-line:
0014-sunlight-congress-csv $ python f.py
-
The program's output to screen should be:
TK