1. Creating and Accessing Lists:
a. How do you create an empty list in Python?
b. Create a list containing the elements: 1, 2, 3, 4, 5.
c. Access the third element of the list you created in b.
2. List Manipulation:
a. Append the number 6 to the list from question 1b.
b. Remove the element 3 from the list.
c. Replace the second element with 10.
3. List Slicing:
a. Given the list [1, 2, 3, 4, 5], extract a sub-list containing the first three elements.
b. Extract a sub-list containing the last two elements.
4. List Functions:
a. Find the length of the list [10, 20, 30, 40, 50].
b. Find the maximum and minimum values in the list [8, 3, 12, 4, 9, 2].
c. Calculate the sum of all elements in the list [1, 2, 3, 4, 5].
5. List Iteration:
a. Write a loop to print each element of the list [6, 7, 8, 9, 10] on a new line.
b. Write a loop to calculate the square of each element in the list [1, 2, 3, 4, 5] and store it in a new list.
6. List Comprehensions:
a. Using a list comprehension, create a new list containing the squares of numbers from 1 to 10.
b. Using a list comprehension, create a new list containing only the even numbers from the list [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].
7. List Methods:
a. Use the count method to find how many times the number 5 appears in the list [1, 5, 2, 5, 3, 5, 4, 5].
b. Use the index method to find the index of the first occurrence of 3 in the list [1, 2, 3, 4, 3, 5, 6, 3].
8. Nested Lists:
a. Create a nested list [[1, 2], [3, 4], [5, 6]]. Access the element 4 from this list.
b. Using nested loops, print each element in the nested list on a new line.
9. List Sorting:
a. Sort the list [10, 5, 8, 2, 7] in ascending order.
b. Sort the list [10, 5, 8, 2, 7] in descending order.
10. List Operations:
a. Concatenate the lists [1, 2, 3] and [4, 5, 6].
b. Repeat the list [1, 2, 3] three times.