Command Palette

Search for a command to run...

Hectal
Phase 4: Lists, Tuples, Dictionaries and Sets
Python · Exercise 1 of 6Next
Beginner

Edit a shopping cart

The list cart starts as ["milk", "eggs", "bread"].

Change it with list methods so that it ends as ["tea", "milk", "bread", "rice"]: add "rice" at the end, remove "eggs", and put "tea" at the very start.

Then print the number of items in the form Items: 4.

What Check tests

  1. cart ends as ["tea", "milk", "bread", "rice"]
  2. "eggs" is gone
  3. "tea" is the first item
  4. The program prints Items: 4

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

main.py
Sign in to run your code.

Output

Press Run to see what your program prints.