The Checklist
In your compciv-2016 Git repository create a subfolder and name it:
exercises/0015-congress-twitter-profiles
The folder structure will look like this (not including any subfolders such as `tempdata/`:
compciv-2016 └── exercises └── 0015-congress-twitter-profiles ├── a.py ├── b.py ├── c.py ├── d.py ├── e.py ├── f.py ├── g.py ├── h.py ├── i.py
a.py
|
0.5 points | Download and count the number of Twitter accounts operated by Congressmembers |
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 |
g.py
|
0.5 points | TK |
h.py
|
0.5 points | TK |
i.py
|
0.5 points | TK |
Background information
Twitter's API documentation for the user profile data can be found here: [](https://dev.twitter.com/rest/reference/get/users/show)
The data file can be found here:
http://stash.compciv.org/congress-twitter/2016-01/congress-twitter-profiles.json
Examples of individual profiles as JSON files:
a. download b.
- Find the congressmember with the most followers
- Find the congressmember who has the oldest Twitter account
- Find the congressmember who has highest average tweets per day since their account started
- List the 5 congressmembers with 5 highest averages
- find the congress member with the oldest most recent tweet
- count number of congressmembers who sent their latest tweet via an iphone
- List the devices or programs used by congressmembers to send their most recent tweets, sorted in order of frequency
- List every website mentioned in a congressmember's recent tweet, in order of frequency
The Exercises
0015-congress-twitter-profiles/a.py » Download and count the number of Twitter accounts operated by Congressmembers
- Make a tempdata subdirectory inside this working directory.
- Download the JSON file of Twitter profiles (this may take awhile)
- Count the lines and print the number.
The file can be found here:
http://stash.compciv.org/congress-twitter/2016-01/congress-twitter-profiles.json
When you run a.py
from the command-line:
0015-congress-twitter-profiles $ python a.py
-
The program's output to screen should be:
There are 83556 lines in tempdata/congress-twitter-profiles.json
Note that the number of lines in the file do not correspond to number of Twitter accounts.
0015-congress-twitter-profiles/b.py » TK
TK
When you run b.py
from the command-line:
0015-congress-twitter-profiles $ python b.py
-
The program's output to screen should be:
TK
0015-congress-twitter-profiles/c.py » TK
TK
When you run c.py
from the command-line:
0015-congress-twitter-profiles $ python c.py
-
The program's output to screen should be:
TK
0015-congress-twitter-profiles/d.py » TK
TK
When you run d.py
from the command-line:
0015-congress-twitter-profiles $ python d.py
-
The program's output to screen should be:
TK
0015-congress-twitter-profiles/e.py » TK
TK
When you run e.py
from the command-line:
0015-congress-twitter-profiles $ python e.py
-
The program's output to screen should be:
TK
0015-congress-twitter-profiles/f.py » TK
TK
When you run f.py
from the command-line:
0015-congress-twitter-profiles $ python f.py
-
The program's output to screen should be:
TK
0015-congress-twitter-profiles/g.py » TK
TK
When you run g.py
from the command-line:
0015-congress-twitter-profiles $ python g.py
-
The program's output to screen should be:
TK
0015-congress-twitter-profiles/h.py » TK
TK
When you run h.py
from the command-line:
0015-congress-twitter-profiles $ python h.py
-
The program's output to screen should be:
TK
0015-congress-twitter-profiles/i.py » TK
TK
When you run i.py
from the command-line:
0015-congress-twitter-profiles $ python i.py
-
The program's output to screen should be:
TK