Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
How do you change an element in a list?
Think about how we reference items in a list.
What happens if you try to access an index after deleting it?
Remember what we discussed about list indexing.
What will happen if you execute del colors[0]?
Think about what delete operations do.
Can you update a list element using a negative index?
Negative indexing counts from the end of the list.
Create a list of at least five different fruits. Update the third fruit to 'grape' and remove the first fruit. Show the final list.
Remember how to refer to the indices.
You have a list of numbers. Write a program that updates the last number to 10 and removes the second number. What will the resulting list be?
Use negative indexing for the last item.
5 more questions in this section. Enroll free to practise them all.
Enroll free