List Practice Problems
The best way to master lists is by solving problems. This lab contains a series of hands-on exercises, from basic to advanced, to solidify your understanding. Each problem includes an interactive runner so you can test your solution instantly.
Beginner Exercises
Beginner Exercises
These problems focus on fundamental list creation, indexing, and basic methods.
PygroundTry It Out
Create a list containing the first five positive integers. Then, print the element at index 2.
Expected Output:
The list is: [1, 2, 3, 4, 5] The element at index 2 is: 3
Output:
PygroundTry It Out
You have a list of groceries. Add 'bread' to the end of the list and then print the modified list.
Expected Output:
['milk', 'eggs', 'cheese', 'bread']
Output:
PygroundTry It Out
Given a list of numbers, create a new list containing only the numbers greater than 10.
Expected Output:
[12, 15, 20]
Output:
PygroundTry It Out
Check if the name 'Alice' is present in a list of attendees.
Expected Output:
Is Alice attending? True
Output:
Last updated on