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 is the index of the first item in a list?
Think about how counting starts.
Using the list colors = ["red", "green", "blue"], what does colors[1] return?
What position is 'green' in?
What does colors[0] return if colors = ["red", "green", "blue"]?
Think about the starting point of counting.
True or false: Negative indexing allows access to list elements from the end.
Recall what negative numbers indicate in indexing.
Create a list of your top 5 favorite fruits. Demonstrate accessing the first, middle, and last fruits using both regular and negative indexing.
Remember, the middle item’s index will require some thought.
Given a list with a 0 to 9 range, refer to the last four elements using only negative indexing and print them out.
How do you slice the negative indices to include all last four?
6 more questions in this section. Enroll free to practise them all.
Enroll free