programming wigth python

0 comments

I have every thing just build on what I have give it to you. It’s a very easy assignment.

Objective

Demonstrate an understanding of:

  • File I/O
  • Unit Tests (Optional)

Specification

Create a new global string object called filename. Set filename equal to:

'./AB_NYC_2019.csv' (for Mac/Linux) 
'AB_NYC_2019.csv' (for Windows)

Create a new method in the DataSet class called load_file(). This method should load all the data from the Airbnb data file into self._data. Use the global filename object to specify the file to open. The function should report how many lines are loaded.

Update option 4 in the menu to call load_file() instead of load_default_data().

Optional – Extra Credit (5 points):

Create a separate file and write a unit test using the unittest module. At a minimum, verify that 48895 lines of Airbnb data were loaded. Your unit test must use the techniques in the Advanced Unit Testing module.

Sample Run

Your sample run should be used to verify that all properties are loaded. You must verify that the calculations made by your code match the results below. Also make sure your tables still look good!

Please enter your name: Eric
Hi Eric, welcome to Foothill's database project.
What is your home currency?NZD
Enter a header for the menu:
AirBNB Final
Options for converting from NZD:
NZD USD EUR CAD GBP CHF AUD JPY
10.00 7.09 5.96 8.72 5.11 6.52 9.36 785.82
20.00 14.18 11.91 17.45 10.21 13.05 18.72 1571.63
30.00 21.28 17.87 26.17 15.32 19.57 28.09 2357.45
40.00 28.37 23.83 34.89 20.43 26.10 37.45 3143.26
50.00 35.46 29.79 43.62 25.53 32.62 46.81 3929.08
60.00 42.55 35.74 52.34 30.64 39.15 56.17 4714.89
70.00 49.65 41.70 61.06 35.74 45.67 65.53 5500.71
80.00 56.74 47.66 69.79 40.85 52.20 74.89 6286.52
90.00 63.83 53.62 78.51 45.96 58.72 84.26 7072.34

copyright 2021 Eric Reed
AirBNB Final
Main Menu
1 - Print Average Rent by Location and Property Type
2 - Print Minimum Rent by Location and Property Type
3 - Print Maximum Rent by Location and Property Type
4 - Load Data
9 - Quit
What is your choice? 1
Please Load a Dataset First
AirBNB Final
Main Menu
1 - Print Average Rent by Location and Property Type
2 - Print Minimum Rent by Location and Property Type
3 - Print Maximum Rent by Location and Property Type
4 - Load Data
9 - Quit
What is your choice? 2
Please Load a Dataset First
AirBNB Final
Main Menu
1 - Print Average Rent by Location and Property Type
2 - Print Minimum Rent by Location and Property Type
3 - Print Maximum Rent by Location and Property Type
4 - Load Data
9 - Quit
What is your choice? 3
Please Load a Dataset First
AirBNB Final
Main Menu
1 - Print Average Rent by Location and Property Type
2 - Print Minimum Rent by Location and Property Type
3 - Print Maximum Rent by Location and Property Type
4 - Load Data
9 - Quit
What is your choice? 4
48895
AirBNB Final
Main Menu
1 - Print Average Rent by Location and Property Type
2 - Print Minimum Rent by Location and Property Type
3 - Print Maximum Rent by Location and Property Type
4 - Load Data
9 - Quit
What is your choice? 1
Shared room Entire home/apt Private room
Manhattan $ 88.98 $ 249.24 $ 116.78
Bronx $ 59.80 $ 127.51 $ 66.79
Staten Island $ 57.44 $ 173.85 $ 62.29
Queens $ 69.02 $ 147.05 $ 71.76
Brooklyn $ 50.53 $ 178.33 $ 76.50
AirBNB Final
Main Menu
1 - Print Average Rent by Location and Property Type
2 - Print Minimum Rent by Location and Property Type
3 - Print Maximum Rent by Location and Property Type
4 - Load Data
9 - Quit
What is your choice? 2
Shared room Entire home/apt Private room
Manhattan $ 10.00 $ 0.00 $ 10.00
Bronx $ 20.00 $ 28.00 $ 0.00
Staten Island $ 13.00 $ 48.00 $ 20.00
Queens $ 11.00 $ 10.00 $ 10.00
Brooklyn $ 0.00 $ 0.00 $ 0.00
AirBNB Final
Main Menu
1 - Print Average Rent by Location and Property Type
2 - Print Minimum Rent by Location and Property Type
3 - Print Maximum Rent by Location and Property Type
4 - Load Data
9 - Quit
What is your choice? 3
Shared room Entire home/apt Private room
Manhattan $ 1000.00 $ 10000.00 $ 9999.00
Bronx $ 800.00 $ 1000.00 $ 2500.00
Staten Island $ 150.00 $ 5000.00 $ 300.00
Queens $ 1800.00 $ 2600.00 $ 10000.00
Brooklyn $ 725.00 $ 10000.00 $ 7500.00
AirBNB Final
Main Menu
1 - Print Average Rent by Location and Property Type
2 - Print Minimum Rent by Location and Property Type
3 - Print Maximum Rent by Location and Property Type
4 - Load Data
9 - Quit
What is your choice? 9
Goodbye! Thank you for using the database

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}