Market Stock
Python
25 pts
Market Stock
A vegetable seller in Keren updates her lists. Make these changes in order:
- Remove the first
"onion"fromstock. - Sell the last item: take it out with
pop()and store it insold. - Delete the items at index 1 and 2 with one
deland a slice. - Empty the list
returnswithclear()(the list must still exist).
Print stock, sold and returns. Expected output:
['tomato', 'pepper'] garlic []
Checklist
- Remove the first
"onion"fromstock. - Take the last item out with
pop()and store it insold. - Delete the items at index 1 and 2 with one
deland a slice. - Empty
returnswithclear(). - Print
stock,soldandreturns.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
