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
These problems focus on fundamental list creation, indexing, and basic methods.
Pyground
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:
Pyground
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:
Pyground
Given a list of numbers, create a new list containing only the numbers greater than 10.
Expected Output:
[12, 15, 20]
Output:
Pyground
Check if the name 'Alice' is present in a list of attendees.
Expected Output:
Is Alice attending? True