Question: My grocery project script got kicked back as a failed script for my project. I am not sure why though as it works in other
My grocery project script got kicked back as a failed script for my project. I am not sure why though as it works in other platforms but does not work in Codio. So the way I formatted something is not HOW codio wanted it formatted. Can you please help me come up with alternative ways to enter my code so that it can pass through codio? I don't know what I did wrong.

1 #these two entries below tell python to create an empty dictionary for our grocery items and an empty 2 #list for our grocery history. Both are defined by two different parameters 3 #dictionaries use the brackets {} while lists use the crates, as I call themJ 4 grocery_item = {} 5 grocery_history = 6 7 stop = 'go' 8 9 #this is our while loop which is telling python while stop is NOT equal to q to 10 #follow the prompts below 11 #all of our inputs below tell python to ouput these questions so we can receieve our users input from the questions 12 13v while stop != 'q': 14 item_name input("Item name:\ ") 15 quantity = input("Quantity purchased:\ ") 16 cost = input("Price per item:\ ") l7 grocery_item['name'] item_name 18 grocery_item['number'] = int(quantity) 19 grocery_item['price'] = float(cost) #our float function makes sure that whatever our cost comes out to be will re 20 grocery_history.append(grocery_item.copy()) #here we are using 'append' which is a quick way of adding grocery it 21 stop = input("Would you like to enter another item?\ Type 'c' For continue or 'q' to quit:\ ") #this is giving ou 22 23 grand_total = 0 #our grand total is of course 0 at the moment but once items are added this will change 24 25 #this is our for loop which tells python for this specific variable to do x, y, and z. 26 #so For this loop we want our item total to equal the number times the price 27 #the grand total plus the item total will give us our grand total 23v for grocery_item in grocery_history: 29 item_total = grocery_item['number'] * grocery_item['price'] 30 grand_total = grand_total + item_total 31 #this below looks crazy but it pretty much tells python to relate our 9nd to number, 965 to name and to apply the tax 32 print('%d '36s @ $96.2f ea $96.2f' 3'6 (grocery_item['number'], grocery_item['name'], grocery_item['price'], item_total)) 33 #2 apple @ $1149 ea $2.98 34 item_total = 0 35 36 #of course this is our final print for our grand total of the items they put on their list 37 print('Grand total $96.2f' % grand_total) r'vl mm Test your (a Test Your Code Single Grocery Item Check Check IL' SHOW DIFF UASTRUN on 10/10/2020. 11-32-31 AM Check 1 failed Output: Item nav Quantit} Price p( Would y( Type c 1 milk 4 Grand t( 4 | > Expecte: Item nar Quantit; Price p4 @
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
