Lecture 19 — Exercises¶

Solutions to the problems below must be sent to Submitty for automatic scoring. A separate file must submitted for each problem. Solutions must be submitted by 4 pm on Friday, April 7.

1. The Restaurant.py file you were provided includes a main code area with code to test functions that have not yet been written (see the methods with pass as their only statements). These are the min_review, the max_review, the latitude and the longitude. Please implement these functions, test them, and submit the resulting Restaurant.py.
2. Copy the code in lec19_restaurant_exercise.py into a file called lec19_american_in_troy.py. Rewrite the main code in this new file to list the names of all Restaurants in Troy that have American in their category and that have an average rating of more than 3.0. The only output should be the alphabetical list of restaurant names, one per line of output. The trick is that you are not allowed to change the Restaurant class at all. This will require that you access and use both one or two methods from Restaurant and some of its attributes directly. Upload your lec19_american_in_troy.py to Submitty when you are done. Submitty will use our Restaurant.py file to test.