20.5 - Modifying List Elements
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
Modify the list fruits = ["apple", "banana"] to change 'banana' to 'pear'.
💡 Hint: Use indexing to access the second item in the list.
How would you change the first item in scores = [98, 85, 75] to a score of 100?
💡 Hint: Remember that the first index is 0.
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What will fruits[1] = 'grapes' do in the list fruits = ['apple', 'banana', 'mango']?
💡 Hint: Think about how indexing works.
True or False: You can modify a list in Python by just assigning a new value to an index.
💡 Hint: Remember what it means for a list to be mutable.
Get performance evaluation
Challenge Problems
Push your limits with advanced challenges
Given a list my_numbers = [2, 4, 6, 8, 10], create a new list that doubles each element.
💡 Hint: Use list comprehension to achieve this.
How can you modify the list names = ["John", "Jane", "Doe"] to change 'Doe' to 'Smith', and print the updated list?
💡 Hint: Locate the index of 'Doe' to make the change.
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.