Question: Lists. Read the problem and answer the following five questions about it . Three friends Amanda, Derek, and Maya decided to have a picnic. They

Lists. Read the problem and answer the following five questions about it.
Three friends Amanda, Derek, and Maya decided to have a picnic. They created a grocery list with nine items and divided the list into three parts (parts can be not equal). Each of them should buy at least two products. Derek and Maya bought the correct products, but Amanda lost her shopping list and bought four products she remembered to be on the grocery list.
However, she only bought one of the products she was supposed to buy and three other products, which were not on her list. One of the products in the grocery list was not bought by anyone.
The following code shows what happened with the shopping list and shopping cart of Amanda. You need to find i, j, and k to run it correctly.
HINTS: First, find what products Amanda bought by tracing amanda_shopcart in the code. What the first product did she buy? Did she buy apples? Then, check what she should have bought: she bought only one correct product and one product was not bought by anyone; however, Maya and Derek bought everything what was on their lists!
# PROGRAM CODE
grocery_list =["apples", "bananas", "strawberry", "watermelon", "sausages", "bread", "cheese", "chips", "salsa"]
i =?
j =?
k =?
maya_shoplist = grocery_list[0:i]
amanda_shoplist = grocery_list[i:j]
derek_shoplist = grocery_list[j:]
print(amanda_shoplist) # what she should have bought
amanda_shopcart =[]
for i in range (1,k):
amanda_shopcart.append(grocery_list[i])
#print(amanda_shopcart)
if "apples" in amanda_shopcart:
amanda_shopcart.remove("apples")
else:
amanda_shopcart.insert(0,"apples")
print(amanda_shopcart) # what she actually bought
What product was missing from the picnic because it was not bought by anyone?
Group of answer choices
bananas
sausages
bread
cheese
chips
salsa
strawberry
watermelon
apples

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