Sometimes you need to remove something from a list.

beatles = ["john","paul","george","ringo","stuart"] beatles.remove("stuart") print beatles

This code will print:

  1. We create a list called beatles with 5 strings.
  2. Then, we remove the first item from beatles that matches the string "stuart". Note that .remove(item) does not return anything.
  3. Finally, we print out that list just to see that "stuart" was actually removed.



Remove 'dagger' from the list of items stored in the backpack variable.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?