Campaign Contributions Example

small2016.txt dataset

$ python contributions.py
Welcome to contributions.py v1.0

In this program, you can search for campaign contribution
information by zip code, city, or state.

There are 41 total contribution entries.

Please choose from the following menu.
  (1) search by zip code
  (2) search by city
  (3) search by state
  (4) quit the program

What would you like to do? zip
Enter a valid integer!
What would you like to do? 1
Enter a 5-digit ZIP code: 19803

Contribution information for WILMINGTON, DE 19803
  Clinton:    6 contributions totalling    $2500
  Sanders:    3 contributions totalling    $1250

Please choose from the following menu.
  (1) search by zip code
  (2) search by city
  (3) search by state
  (4) quit the program

What would you like to do? 2

searching by city...

Enter a city: Dover

Here are all the cities I can find that start
with DOVER and have contributions...

       DOVER, DE, 19901,  Democrat:       $0, Republican:    $500

Please choose from the following menu.
  (1) search by zip code
  (2) search by city
  (3) search by state
  (4) quit the program

What would you like to do? 2
searching by city...

Enter a city: Wil

Here are all the cities I can find that start
with WIL and have contributions...

  WILMINGTON, DE, 19802,  Democrat:     $450, Republican:      $0
  WILMINGTON, DE, 19803,  Democrat:    $3750, Republican:      $0
  WILMINGTON, DE, 19805,  Democrat:     $200, Republican:      $0
  WILMINGTON, DE, 19806,  Democrat:    $1750, Republican:      $0
  WILMINGTON, DE, 19807,  Democrat:    $7000, Republican:   $7900
  WILMINGTON, DE, 19808,  Democrat:     $250, Republican:      $0
  WILMINGTON, DE, 19809,  Democrat:     $750, Republican:    $200
  WILMINGTON, DE, 19810,  Democrat:    $3200, Republican:      $0
  WILMINGTON, DE, 19899,  Democrat:     $250, Republican:      $0

Please choose from the following menu.
  (1) search by zip code
  (2) search by city
  (3) search by state
  (4) quit the program

What would you like to do? 3
Enter a two digit state code: PA
There were no campaign contributions in that state.
Please choose from the following menu.
  (1) search by zip code
  (2) search by city
  (3) search by state
  (4) quit the program

What would you like to do? 3
Enter a two digit state code: DE

Top five contribution zip codes for Clinton in DE:
  REHOBOTH BEACH, DE 19971: 18 contributions totalling  $11600
      WILMINGTON, DE 19807:  5 contributions totalling   $6800
           LEWES, DE 19958:  4 contributions totalling   $6400
      WILMINGTON, DE 19810:  2 contributions totalling   $3200
        ROCKLAND, DE 19732:  3 contributions totalling   $3200

Top five contribution zip codes for Cruz in DE:
      WILMINGTON, DE 19807:  4 contributions totalling   $6400
          NEWARK, DE 19711:  2 contributions totalling   $3700
  REHOBOTH BEACH, DE 19971:  3 contributions totalling   $1000
           DOVER, DE 19901:  2 contributions totalling    $500
         MILFORD, DE 19963:  1 contributions totalling    $250

Top five contribution zip codes for Kasich in DE:
      WILMINGTON, DE 19807:  1 contributions totalling   $1000

Top five contribution zip codes for Sanders in DE:
      WILMINGTON, DE 19803:  3 contributions totalling   $1250
          NEWARK, DE 19711:  3 contributions totalling    $700
      WILMINGTON, DE 19806:  2 contributions totalling    $550
          SMYRNA, DE 19977:  2 contributions totalling    $500
         NEWPORT, DE 19804:  2 contributions totalling    $500

Top five contribution zip codes for Trump in DE:
      WILMINGTON, DE 19807:  1 contributions totalling    $500
          NEWARK, DE 19702:  1 contributions totalling    $250


***Click anywhere in the graph window to continue.***

Please choose from the following menu.
  (1) search by zip code
  (2) search by city
  (3) search by state
  (4) quit the program

What would you like to do? 4
OK.  Goodbye!


Return to Lab 09