Reference no: EM132356511
Programming Assignment - Files and Exceptions
For this assignment, you will write a menu driven console program that loads, parses and analyzes a comma-separated values (CSV) file of real estate data. MS Excel can read and write CSV files, so they are handy for exchanging data between a program and MS-Excel.
Requirements
1. Use the python_template_advanced_with_unit_tests.py for your code. They can be found in D2L > Content > Resources > Templates as the basis for your program.
2. Download the data file for this assignment from Dropbox for this assignment and put it in the same directory as your program, or create a function that creates a absolute path to the file, so that the function that read the data can find it - where ever it is - on disk.
3. Write your code using functions and include:
a. A top-level function called main() that implements your program by using other functions to perform specific tasks as needed.
b. A function called print_header() that prints the name of the program once it starts running.
c. A function called menu() that interacts with the user by presenting a list of choices.
Provides a limited set of choices to the user. Your menu should allow the user to repeatedly make choices until they select [q]uit and should include:
i. Here is the string to present to the user:
‘[L]oad, [P] find hi/lo priced, [A]verage all properties,
[C]ondo averages: ‘
ii. L for load (see e below)
iii. P to find the highest and lowest priced properties (see f below)
iv. A finds average prices for all properties (see g below
v. C find the condominium averages (see h below)
vi. Q to quit the program
Additionally,
vii. The choice made by the user should be returned to main.
viii. In main, each choice the user makes should result in a function being called to perform the required work and display the results, or to exit the program if the users selects [q]uit).
d. Formatting matters of your output matters, for example, prices should have a $ symbol followed by a floating-point value. Floating point numbers should be limited to two decimal places
e. A function called read_data() that reads the data file and loads the data into a list of dictionaries by using the DictReader class the Python's Standard Libraries csv package. Make sure you close the data file after it has been read.
f. A function called find_high_and_low() finds the highest priced and lowest priced properties and returns them as a tuple of integers.
g. A function called find_average() that finds the average price of all properties and returns the value as an integer.
h. A function called find_condo_average() that finds the average price, number of bedrooms, and numbers of baths for condominiums. Return these values as a tuple.
4. Use the following naming convention for your program:
csc119_<first name>_assignment#_<short description>.py
csc119_katlin_11_process_csv.py for example.
5. Submit your program to D2L > Dropbox > Programming 6 - Files & Exceptions by the Tuesday July 26 at 11:30 PM deadline and make sure it runs, even if it is not complete.
6. Add unit test(s) for each of your functions that test its important functionality.