Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help me with this task. Thanks. The task is broken down into three sections. Section 1 User Input Section 2 loop through the grocery
Please help me with this task. Thanks.
The task is broken down into three sections. Section 1 User Input Section 2 loop through the grocery list Section 3 - provide output to the console *Task: Create the empty data structure grocery-item = ? grocery nistory *Variable used to check if the while loop condition is met stop E while ?2??? *Accept input of the name of the groce ry item purchased. *Accept input of the quantity of the grocery item purchased. #Accept input of the cost of the grocery item input (this is a per-item cost). sUsing the update function to create a dictionary entry which contains the name, number an *Add the grocery-item to the grocery-history List using the append function *Accept input from the user asking if they have finished entering grocery items. * Define variable to hold grand total called grand_total *Define a for' Loop for 222?? in 222222227: *Calculate the total cost for the grocery_item. *Add the item-total to the grand-total *Output the information for the grocery item to match this example: #2 apple @s1.49 ea $2.98 Test Your Code nilk 2.99 Single Grocery Item Check Check l! SHOW DIFF LAST RUN on 2/7/2019 43:23 PM Check 1 failed Output: inter item_nane: Enter quantity Purchased: Ente ype .C' for continue or ,q, to quit: raceback (most recent call last): File "grocery list.py", ine 40, in cmodule> item total -grocery iteml'number] groce ypeError: can't multiply sequence by non-int Expected: Item nane: Quantity purchased: Price per iten: ould you like to enter another item? Type "c for continue or q to quit: 1 milk $2.99 ea $2.99 Grand total: $2.99 Test Your Code 99s 3.99 onions 8.79 Multiple Grocery Check Check I! SHOW DIFF LAST RUN on 2/72019 84323 PM Check 1 failed Output: Enter item nane: Enter quantity Purchased: Ente Type C for continue or q to quit: Enter iter Type C for continue or q to quit: Enter Iter Type C for continue or q to quit: Traceback (most recent call last) File "grocery list.py", line 48, in cmodule Iten total -grocery_iteml number'] groce TypeError: can't multiply sequence by non-Int Expected Item nane: Quantity purchased Price per tem Would you like to enter another Item Type for continue or 'q to quitStep 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