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
Before getting started, copy
checkpy to check py and develop your code for Checkpoint
in
checkpy
Now modify your code to ask the user for the id of a restaurant from up to and including
the length of the restaurants list humans don't need to know about list ids starting at
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 corresponds to list index 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:
up to This restaurant is rated very good, based on x reviews.
where 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 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 and
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
