Python Introducing Lists Using Lists Mutability

Firas Al-Mahrouqi
Firas Al-Mahrouqi
1,559 Points

Why wasn't del() used instead of remove()?

In previous lessons, Craig used del() to remove elements from a list, but not in this example. What is the reason for this?

1 Answer

Nicolas Suter
Nicolas Suter
1,546 Points

Remove removes the first matching value, not a specific index. Del removes the item at a specific index. Pop removes the item at a specific index and returns it.