Question: i ' m not sure what is causing the issue here. this assignment is due early tomorrow morning so any and all help is appreciated

i'm not sure what is causing the issue here. this assignment is due early tomorrow morning so any and all help is appreciated ): ```
def update_quantity(inventory, item_list, quantity_list):
for i in range(len(item_list)):
item = item_list[i]
quantity = quantity_list[i]
if item in inventory:
index = inventory.index(item)
inventory[index +1]+= quantity
else:
inventory.append(item_list)
inventory.append(quantity_list)
return inventory
``````
===========================================================================
Traceback (most recent call last):
File "/Users/trippydooda/Downloads/tester3.py", line 340, in test_update_quantity_8
```
```
First list contains 2 additional elements.
First extra element 8:
'Apple'
-['Orange',20, 'Bread', 50, 'Banana', 50, 'Milk', 80, 'Apple', 50]
?
+['Orange',20, 'Bread', 50, 'Banana', 50, 'Milk', 80]
============================================================================
FAIL: test_update_quantity_9(__main__.AllTests.test_update_quantity_9)
Traceback (most recent call last):
File "/Users/trippydooda/Downloads/tester3.py", line 344, in test_update_quantity_9
self.assertEqual(update_quantity(lst,['Apple','Milk','Bread', 'Banana','Orange'],[1,1,1,1,0]),['Orange',0, 'Bread', 1, 'Banana', 1])
AssertionError: Lists differ: ['Orange',0, 'Bread', 1, 'Banana', 1, 'Apple', 1, 'Milk', 1]!=['Orange',0, 'Bread', 1, 'Banana', 1]
First list contains 4 additional elements.
First extra element 6:
'Apple'
_['Orange',0, 'Bread', 1, 'Banana', 1, 'Apple', 1, 'Milk', 1]
?
+['Orange',0, 'Bread', 1, 'Banana', 1]
```
i ' m not sure what is causing the issue here.

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!