Difference between revisions of "CSC111 Homework 11 2015b"
Line 47: | Line 47: | ||
</source> | </source> | ||
<br /> | <br /> | ||
− | :However, if some characters in the file are not valid characters (for example double-quotes created in TextEdit or NotePad are not regular ASCII character and could resolve in the program crashing on a "Non-Ascii" exception. | + | :However, if some characters in the file are not valid characters (for example double-quotes created in TextEdit or NotePad are not regular ASCII character and could resolve in the program crashing on a "Non-Ascii" exception.) |
+ | <br /> | ||
* An alternative is to use this method (presented in Zelle): | * An alternative is to use this method (presented in Zelle): | ||
<br /> | <br /> |
Latest revision as of 17:53, 22 November 2015
--D. Thiebaut (talk) 08:24, 18 November 2015 (EST)
This assignment is due the week after Thanksgiving, on Thursday 12/4/15, at 11:55 p.m.
The CSV file generated during the lab has been removed from the shared Google file, and is now available here.
<showafterdate after="20151119 12:00" before="20151231 00:00">
Contents
Assignment
Your assignment is to write a Python program that will read the contents of the shared CSV file containing all the map elements contributed by the whole CSC111 class, and create a map of Smith College where buildings are color coded by their year of construction.
Building Construction Dates
- The file containing the dates each building was erected can be found here.
Requirements
- Your program should be well documented, with a header with the names of the pair partners, and a description of what the program does.
- Functions and classes should be documented as well.
- Your program should display buildings only once (no overlay allowed).
- Your program should display at least one other map element that is not a building.
- The buildings should be color-coded according to their year of construction.
- Creativity and originality will be taken into account when grading.
Moodle Submission
- Submit a copy of your program to Moodle, in the HW 11 Program section.
- Submit a screen shot of your map to Moodle, in the HW 11 Map section.
Hints and Recommendations
reading the CSV file
- You have several options for reading a file. The option we have used most often in class is this one:
file = open( "someName.ext", "r" ) lines = file.readlines() file.close()
- However, if some characters in the file are not valid characters (for example double-quotes created in TextEdit or NotePad are not regular ASCII character and could resolve in the program crashing on a "Non-Ascii" exception.)
- An alternative is to use this method (presented in Zelle):
file = open( "someName.ext", "r" ) for line in file: print( line ) # or some processing of your choice.
- This way, if a line contains an invalid character, you can treat the exception with a try/except clause.
</showafterdate>