Program 3: Video Games File Processing
Logistics
- Due Date: Friday, October 13th no later than 11:59 p.m.
- Partner Information: You may complete this assignment
individually or with exactly one partner. If you work with a partner,
you must both be enrolled in the same lab section.
- Submission Instructions (working alone): Upload your solution,
entitled YourFirstName-YourLastName-Program3.py to the
BrightSpace Program 3 Dropbox.
- Submission Instructions (working with one lab mate): Upload your
solution, entitled
YourFirstName-YourLastName-PartnerFirstName-PartnerLastName-Program3.py
to the BrightSpace Program 3 Dropbox. Note: If you work with a partner,
only one person needs to submit a solution. If you both submit a
solution, the submission that will be graded is the one from the partner
whose last name comes alphabetically first.
- Deadline Reminder:
Once the submission deadline passes, BrightSpace will no
longer accept your Python submission and you will no longer
be able to earn credit. Thus, if you are not able to fully complete
the assignment, submit whatever you have before the deadline so that
partial credit can be earned.
Learning Outcomes
- To gain experience with Python files.
Background Information
- Download Program3.py and rename it
according to the instructions above.
- Download this video_games.csv
file into the same directory as your Program 3 python program.
The file contains information about video games
that were released between the years 2004 and 2008.
The provided csv file is inspired by the more complete
and differently ordered Video Games CSV file available on
this
page.
Assignment
- Write a function named add_age that reads a csv
file identified by the value of the first parameter
("video_games.csv" in the supplied code) and
creates a new file identified by the value of the second parameter
("enhanced_video_games.csv" in the supplied code).
In the new file, insert a second column with the label Age in Years
that shows how old each video game is. Do
the calculation using the CURRENT_YEAR constant that is provided
with the starting code.
(In Python, variables that should never be changed, i.e. constants,
appear in all capital letters.) If your program works correctly,
the file created will match this
one.
- Write a function named unique_consoles that reads
a csv file identified by the value of the parameter
("video_games.csv" in the supplied code) and prints
a numbered, alphabetically ordered list of the unique
consoles that appear in the file. Match the formatting in this
sample.
Tips and Hints
- Before writing any Python code, make sure you understand the
video_games.csv file.
- If the unique_consoles function is correct, the first
unique console printed will be 1. Nintendo DS.
Grading - 100 points
- 50 points. The add_age function works correctly
(30 points, all or nothing), contains a function header comment
(5 points), contains comments in the code that help the user
understand anything that is tricky (5 points), and is
a high quality solution (10 points - 5 points for each type
of improvement).
- 50 points. The unique_consoles function works correctly
(30 points, all or nothing), contains a function header comment
(3 points), contains comments in the code that help the user
understand anything that is tricky (2 points), produces console
output whose format matches the desired output format (5 points)
and is a high quality solution (10 points - 5 points for each type
of improvement).
Honor's Lab
- The points you earn from the grading scale above will be
multiplied by .9 for a maximum of 90 points.
- The other 10 points can be earned by writing and calling
a third, non-trivial function that does something interesting
with the video games file.
- In the BrightSpace Dropbox comment box, describe
your enhancement clearly. (You must include this comment
to earn the additional points.)