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.
Restaurant.pyfile you were provided includes a main code area with code to test functions that have not yet been written (see the methods with
passas their only statements). These are the
longitude. Please implement these functions, test them, and submit the resulting
- Copy the code in
lec19_restaurant_exercise.pyinto 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
Restaurantclass at all. This will require that you access and use both one or two methods from
Restaurantand some of its attributes directly. Upload your
lec19_american_in_troy.pyto Submitty when you are done. Submitty will use our
Restaurant.pyfile to test.