Answered step by step
Verified Expert Solution
Question
1 Approved Answer
HoneyDoToo: Saving Your Relationship Once Again 10 Possible Points Due: Fri Feb 10, 2023 1:59pm IN PROGRESS Next Up: Submit Assignment Unlimited Attempts Allowed Details
HoneyDoToo: Saving Your Relationship Once Again 10 Possible Points Due: Fri Feb 10, 2023 1:59pm IN PROGRESS Next Up: Submit Assignment Unlimited Attempts Allowed Details Scenario: You recently developed a program called HoneyDo which will reorder a list of groceries based on a provided canonical item ordering. However, you notice over time that is has become tiresome to list the items in canonical order (that list is pretty large). On top of that, you have since discovered that you can scrape the website of the grocery store to obtain an inventory of each item with its category listed. You decide to use this inventory to your advantage by changing your canonical list to only store the category of the items you would encounter as you traverse the store in your preferred order (a much smaller list). Your assignment: Refactor your HoneyDo program into a new program called HoneyDooToo which reorders a list of groceries based on a set of canonical categories and a provided store inventory. Your program must read a list of groceries from a text file called "groceries.txt" wherein each item to be purchased is listed on its own line of a file (shown below). Your program should also read a separate file called "canonical.txt" which lists the sequence of all the grocery store categories that you might encounter in their "canonical" ordering (also shown below). Finally, your program should also read the contents of a file called "inventory.txt" which lists the items and categories of each item for sale in the store. The output of your program is printed to the screen and shows both the original grocery list as well as the canonically re-ordered list by category (again, also shown below). \# ignore comments lines that start with '\#' milk wheat bread onions cap'n crunch ice cream toothpaste apples pizza ketchup mtn. dew Example of canonical.txt \# ignore comments lines that start with '\#' produce deli soft drinks breads cereal toiletries condiments dairy frozen An example of inventory.txt: \# ignore comments lines that start with '\#' breads: wheat bread condiments: ketchup condiments: mustard dairy: cheese dairy:ice cream dairy:milk deli:bologna deli:chicken frozen:burritos frozen:pizza cereal:cap' n crunch produce: apples produce:bananas produce: onions soft drinks:mtn. dew toiletries:toothpaste The output of the program is below: Your Original Order: mi1k wheat bread oniions cap"n crunch ice cream toothpaste apples pizza ketchup mtn. dew Your Canonical Category Order: Section: produce apples onons Section: soft drinks mtn. dew Section: breads wheat bread Section: cereal cap"n crunch Section: toiletries toothpaste Section: condiments ketchup Section: dairy milk ice cream Section: frozen pizza Save your program as "LastName_HoneyDoToo.py" where "LastName" is your last name and submit it to canvas for this assignment. Your program will be scored in the following manner: - Program executes and runs to completion with no errors (5pts) - Program executes with sample input and gives correct sample output (2pts) - Program executes with my test input and gives correct test output (2 pts) - Program is commented and best patterns/practices are followed (1 pt)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started