20.3 - Accessing Elements from a List
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
Access the first element from the list fruits = ['apple', 'banana', 'mango'].
💡 Hint: Remember to use index 0.
What does fruits[-1] return if fruits = ['apple', 'banana', 'mango']?
💡 Hint: Think about the last item in the list.
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What will fruits[0] return if fruits = ['apple', 'banana', 'mango']?
💡 Hint: Look at the first position in the list.
Is fruits[-1] equal to the last item in the list?
💡 Hint: Think about what -1 refers to.
2 more questions available
Challenge Problems
Push your limits with advanced challenges
Given the list mixed = [5, 'cat', 'dog', 9.0, True], find the value at index 2 and at index -1.
💡 Hint: Use both positive and negative indices to retrieve the values.
You have a list of names: names = ['Alice', 'Bob', 'Charlie', 'David']. Write an expression to print the second and third names using negative indexing.
💡 Hint: Think about how negative indexing works from the end.
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.