Question: Checkpoint 2 Before getting started, copy check 1 . py to check 2 . py and develop your code for Checkpoint 2 in check 2

Checkpoint 2
Before getting started, copy
check1.py to check2. py and develop your code for Checkpoint 2
in
check2.py.
Now modify your code to ask the user for the id of a restaurant from 1 up to and including
the length of the restaurants list (humans don't need to know about list ids starting at
0. Assume the user enters a number. If the user enters a value outside of the value range,
print a warning and do nothing else.
If the user has entered a valid id, you will print the information for the restaurant corre-
sponding to this id (remember: id 1 corresponds to list index 0). Test your code well first
to make sure that you only print a restaurant for a valid id.
The second task in this part is to improve on the print function by changing the average
score computation. Given the scores for a restaurant, you will drop the max and the min,
and find the average of the rest. Remember that you do not have to explicitly remove the
max, and min from the list, just subtract their values from the sum.
Once you have computed the average, instead of printing it, print one of the following based
on the score:
4 up to 5 This restaurant is rated very good, based on x reviews.
where x is the total number of reviews for this restaurant.
Beware: it does not make sense to remove max and min if there are less than three reviews
for a restaurant. In this case, we should use the average of all the values (another if
statement!).
To complete Checkpoint 2, show the lab TA or a mentor the code and the output.
Please check to make sure your code follows the structure we require: first imports, then
functions and then the actual code. Test your code with values 8,22,33, and 44.
 Checkpoint 2 Before getting started, copy check1.py to check2. py and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!