Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
What does the remove() method do in a list?
Think about how you tell it what to remove.
What will happen if you try to remove a value not present in the list?
What does the error say when something is not found?
What does the remove() method do in a list?
Think about what happens to duplicates.
True or False: The pop() method can remove the last item in a list if no index is specified.
Remember what the term 'pop' means.
Create a list of your five favorite movies. Then, demonstrate how to remove the second movie using remove(), pop the last movie, and delete the first movie using del. Show the list after each operation.
Pay attention to how each method affects the list.
Suppose you have a list of integers from 1 to 10. Write code that uses remove(), pop(), and del in a sequence and show the resulting list each time.
Be sure to check which item is at each index when using pop and del.
6 more questions in this section. Enroll free to practise them all.
Enroll free