Question: To start, you should copy the provided starter code into your own Google Colab, run the program and observe the output, and then take a

To start, you should copy the provided starter code into your own Google Colab, run the program and observe the output, and then take a look through the code. You may not understand the code 100%, but taking a quick look through what's there will be helpful to start the assignment.
You are going to systematically replace the TODO comments with code so that the program will work as intended.
(Completed from Part 1)TODO 0 is in both HW4_Restaurant.ipynb (i.e., main) and restaurant.py. Import the necessary functions from restaurant.py into the main. Then in restaurant.py either import all of math and random right away, or import just the functions that you need as you write the code. DO NOT move the functions over to HW4_Restaurant.ipynb. Use *imports* so that those functions can stay in restaurant.py.
TODO 1 is inside the get_num_people() function. You should set the variable guest to a random number from 2 and 10(inclusive) to simulate the number of people you're inviting. This is not user input. This is a computer-generated pseudorandom number using Python's random moduleLinks to an external site..
TODO 2 is below TODO 1. Print the number of people on the screen (see the first line in the sample outputs.)
TODO 3 is in the restaurant_choice() function. You need to write a series of if-statements that use the parameters to get the possible restaurants with dietary restrictions. Your restaurant choices are as follows:
Restaurant Vegetarian Vegan Gluten-Free Food price
1. Joe's Burgers No No No $10.00
2. MOD Pizza Company Yes No Yes $15.50
3. Mama's Fine Italian Yes No No $25.00
4. Cafe Rio Yes Yes Yes $35.50
5. Chef's Kitchen Yes Yes Yes $40.00How to read this table? For example, if a user enters - yes vegetarian, no vegan, yes gluten-free, then the choice will be #2, #4, and #5 as those restaurants serve vegetarian and gluten-free food. Also, #4 and #5 will display always as both restaurants serve all types of food(i.e., Yes-Yes-Yes) See more examples in the Example Output below.
TODO 4 is below TODO 3. In your series of if-statements for TODO3, you need to display only the restaurants to which you may take the group based on the dietary restrictions.
TODO 5 is below TODO 4. Print the message for the user to select a number of restaurants. e.g.,4 for Cafe Rio
TODO 6 is still in the restaurant_choice() function. You will call the restaurant_food_price() function to get the food price of the restaurant: $10.00, $15.50, $25.00, $35.5, $40.00, and return it.(Yes, a function can call another function and get a return value!)
TODO 7 is in the restaurant_food_price() function. You will need to write if-statements based on restaurant type that will set the food price to the appropriate value based on the dietary restrictions. e.g., if a user selects #1, then the price is 10
TODO 8 is to print the food price on the screen before returning the price.
Pause here and run your program and see any errors. Your program should run up to the price of each food!
TODO 9 is in the calculate_discount() function. You will need to write if-statements to return a 20% discount if it's 5 or more people and print "Wow, you have many friends!". If it's 4 or less, there's no discount.
TODO 10 is in print_receipt() function. Since the parameter discount is in the format 0.20 to be used in calculations, we need a new variable that contains 20 in order to print the receipt in a human-readable way(i.e.,20%)
TODO 11 is to format the numbers in the receipt to only 2 decimal places when printing a number to the screen. So instead of something like 23.45666666667 printing, we want 23.45(or 23.46). Essentially, we want all references to money to print with 2 decimal places (though trailing zeros may be missing).
TODO 12. Bugs?! What? My code has bugs? Indeed it does. If you check out the receipt, the total after discount and savings are not correct. In print_receipt(), correct where the calculations are being made so that the summary reads properly.

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 Programming Questions!