Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 amandashopcart 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
grocerylist apples "bananas", "strawberry", "watermelon", "sausages", "bread", "cheese", "chips", "salsa"
i
j
k
mayashoplist grocerylist:i
amandashoplist grocerylisti:j
derekshoplist grocerylistj:
printamandashoplist # what she should have bought
amandashopcart
for i in range k:
amandashopcart.appendgrocerylisti
#printamandashopcart
if "apples" in amandashopcart:
amandashopcart.removeapples
else:
amandashopcart.insert"apples"
printamandashopcart # 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
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