vicki_charles
21h ago โข 0 views
Hey everyone! ๐ Ready to supercharge your Python skills? Lists are fundamental, and knowing them inside out is key to becoming a proficient programmer. Let's test your knowledge with a quick quiz! ๐
๐ป Computer Science & Technology
1 Answers
โ
Best Answer
carolyn706
Mar 11, 2026
๐ Quick Study Guide
- ๐ก What are Lists? Lists are ordered, mutable collections of items. They are one of the most versatile data structures in Python and can hold elements of different data types.
- ๐ข Indexing & Slicing: Elements in a list are accessed by their index, which starts at 0. Slicing allows you to extract a sub-list using `[start:end:step]`. Negative indexing can be used to access elements from the end of the list.
- โ Common Operations:
- โจ
append(item): Adds a single item to the end of the list. - ๐๏ธ
insert(index, item): Inserts an item at a specified index, shifting subsequent elements. - โ๏ธ
pop(index): Removes and returns the item at a given index. If no index is specified, it removes and returns the last item. - โ
remove(value): Removes the first occurrence of a specified value from the list. - ๐
len(list): Returns the number of items in the list. - ๐
sort(): Sorts the list in-place (modifies the original list). - โฉ๏ธ
reverse(): Reverses the order of elements in the list in-place. - โ
+operator: Used to concatenate (join) two or more lists. - โ๏ธ
*operator: Used to repeat a list a specified number of times.
- โจ
- ๐ง Mutability: Lists are mutable, meaning their elements can be changed, added, or removed after the list has been created.
- ๐ง Nested Lists: Lists can contain other lists, allowing for the creation of complex, multi-dimensional data structures.
๐ Practice Quiz
1. Which of the following is the correct way to create an empty list in Python?
my_list = {}my_list = ()my_list = []my_list = new list()
2. What is the output of my_list = [10, 20, 30]; my_list.append(40); print(my_list)?
[10, 20, 30][10, 20, 30, 40][40, 10, 20, 30]Error
3. How do you access the element 'banana' from the list fruits = ['apple', 'banana', 'cherry']?
fruits[2]fruits.get(1)fruits[1]fruits(1)
4. What will be the value of my_list after my_list = [1, 2, 3, 4, 5]; my_list.remove(3);?
[1, 2, 4, 5][1, 2, 3, 4][1, 2, 5]Error
5. Which method is used to add an element at a specific index in a list?
add()push()insert()put()
6. What is the output of list1 = [1, 2, 3]; list2 = [4, 5]; list3 = list1 + list2; print(list3)?
[1, 2, 3, 4, 5][1, 2, 3], [4, 5][[1, 2, 3], [4, 5]]Error
7. Lists in Python are:
- Immutable and unordered
- Mutable and ordered
- Immutable and ordered
- Mutable and unordered
Click to see Answers
1. C
2. B
3. C
4. A
5. C
6. A
7. B
Join the discussion
Please log in to post your answer.
Log InEarn 2 Points for answering. If your answer is selected as the best, you'll get +20 Points! ๐