Difference between revisions of "CSC111 Homework 11 2018"
(→Make-Up Homework) |
(→Assignment) |
||
Line 29: | Line 29: | ||
=Assignment= | =Assignment= | ||
<br /> | <br /> | ||
− | * Write a program that | + | * Write a program that processes a csv file that has been downloaded from the department of eduction of the U.S. government. |
− | * | + | It contains the scorecard for 7,594 colleges and universities in the States. Each college/university is listed on one line, as a scorecard. Each scorecard contains 123 fields. The city where the college/university is located is the field at Index 4. The state is in the field at Index 5. |
− | * | + | * The original file was downloaded from https://catalog.data.gov/dataset?res_format=CSV and is mirrored here: http://cs.smith.edu/~dthiebaut/111/collegeScorecard.csv |
+ | * You should use the smith college URL in your program. | ||
+ | * Your program should output the 10 cities that contain the largest number of colleges and universities. | ||
+ | * The output should be formatted as followed: | ||
+ | |||
+ | 91 New York, NY | ||
+ | 76 Chicago, IL | ||
+ | ... | ||
+ | ... | ||
+ | ... | ||
+ | 40 Dallas, TX | ||
+ | |||
+ | :The first number is the number of universities or colleges, followed by the name of the city, followed by a comma, followed by the state, as two uppercase letters. | ||
+ | * Your program will not prompt for any input, and will only output 10 lines, as shown above. | ||
+ | * To help you test your program you are given the true first, second and tenth lines of the output. Your program will come up with the others. | ||
+ | * Submit your program as hw11.py in the Homework 11 section on Moodle. | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | [[Category:CSC111]][[Category:Homework]] |
Revision as of 20:16, 19 April 2018
D. Thiebaut (talk) 20:58, 19 April 2018 (EDT)
Make-Up Homework 11
This homework is a make-up homework. You can use it to replace the lowest grade you have received on Homework Assignments 1 to 10.
Here is the algorithm explaining how this works:
hws = [ HW1, HW2, HW3, HW4, HW5, HW6, HW7, HW8, HW9, HW10 ] if HW11 != None: # if you have submitted HW11 minHW = min( hws ) if HW11 > minHW: hws.remove( minHW ) hws.append( HW11 ) # drop lowest, as specified in syllabus minHW = min( hws ) hws.remove( minHW ) # compute average homework grade avgHW = sum( hws )/len( hws )
Assignment
- Write a program that processes a csv file that has been downloaded from the department of eduction of the U.S. government.
It contains the scorecard for 7,594 colleges and universities in the States. Each college/university is listed on one line, as a scorecard. Each scorecard contains 123 fields. The city where the college/university is located is the field at Index 4. The state is in the field at Index 5.
- The original file was downloaded from https://catalog.data.gov/dataset?res_format=CSV and is mirrored here: http://cs.smith.edu/~dthiebaut/111/collegeScorecard.csv
- You should use the smith college URL in your program.
- Your program should output the 10 cities that contain the largest number of colleges and universities.
- The output should be formatted as followed:
91 New York, NY 76 Chicago, IL ... ... ... 40 Dallas, TX
- The first number is the number of universities or colleges, followed by the name of the city, followed by a comma, followed by the state, as two uppercase letters.
- Your program will not prompt for any input, and will only output 10 lines, as shown above.
- To help you test your program you are given the true first, second and tenth lines of the output. Your program will come up with the others.
- Submit your program as hw11.py in the Homework 11 section on Moodle.