Section 1 - Instruction

Last time, we learned how to add items to the end of a list using the .append() method. This lets our lists grow.

But what if we need to take an item out of a list?

Engagement Message

For example, removing a completed task. How might we do that?

Section 2 - Instruction

Python lists have another helpful method called .remove(). This method searches the list for a specific value and removes the first item that matches it.

It modifies the list directly.

Engagement Message

Does .remove() seem useful for managing a shopping list?

Section 3 - Instruction

The syntax is list_name.remove(value_to_remove).

If we have shopping = ["milk", "eggs", "bread"] and run shopping.remove("eggs"), the list changes.

Engagement Message

What do you think the shopping list contains after removing "eggs"?

Section 4 - Instruction

After shopping.remove("eggs"), the list becomes ["milk", "bread"]. The item "eggs" is gone.

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal