Search the courses, subjects, tracks, games and features, or jump straight to a page.
5 cards from this section. Quick, good the night before a test.
Use the append method to add 'grape' to a list of fruits. Write the code.
Remember, `append` adds to the end of the list.
What does remove('apple') do if 'apple' is in the list?
Think of what it means to remove an item from a collection.
What does the append() method do?
Think about where new items are added.
Is pop() safe to call on an empty list?
Consider the implications of removing an item from nothing.
Create a list of 10 numbers. Write a function that sorts them using sort(), reverses the order using reverse(), then prints both the sorted and reversed lists.
Think about how you can apply both methods consecutively to achieve the desired output.
Write a script that starts with a full list of students. Use remove() to take out a student by name, and then pop() to drop the last student from the list. Print the list after each operation.
Ensure you validate that the student exists before trying to remove them.
5 more questions in this section. Enroll free to practise them all.
Enroll free