Clean Up the Stock
Python
15 pts
Clean Up the Stock
The set stock lists the products in a shop in Keren.
- Sugar is sold out: remove
"sugar"withremove(). - The manager also asks to take out
"coffee", but it may not be in stock. Usediscard()so there is no error. - Print the number of products, then the sorted products.
Expected output:
4 ['flour', 'oil', 'rice', 'salt']
Checklist
- Remove
"sugar"fromstockwithremove(). - Take out
"coffee"withdiscard()so there is no error. - Print the number of products, then the sorted products.
🔑 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.
