8.5 - List Methods
Enroll to start learning
You’ve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.
Practice Questions
Test your understanding with targeted questions
Use the append method to add 'grape' to a list of fruits. Write the code.
💡 Hint: Remember, `append` adds to the end of the list.
What does remove('apple') do if 'apple' is in the list?
💡 Hint: Think of what it means to remove an item from a collection.
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What does the append() method do?
💡 Hint: Think about where new items are added.
Is pop() safe to call on an empty list?
💡 Hint: Consider the implications of removing an item from nothing.
1 more question available
Challenge Problems
Push your limits with advanced challenges
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.
💡 Hint: 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.
💡 Hint: Ensure you validate that the student exists before trying to remove them.
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.