This chapter explores lists and dictionaries, two essential data structures in programming, explaining their functions and importance for data manipulation.
What will be the output of the code: print([1, 2] * 3)?
What is the result of executing: [1, 2, 3] + [4] * 2?
What is the correct syntax to create a list in Python?
What is the output of list1[-1] if list1 = [10, 20, 30]?
What is the result of list1 = [1, 2, 3, 4] list1[1:3]?
If list1 = [1, 2, 3, 4, 5], what does list1[-1] return?
Given list2 = [6, 7, 8]; what does list2 * 2 produce?
What type of data structure is a dictionary in Python?
How can you delete a key-value pair from a dictionary?
How would you clear all items from a dictionary `dict1`?
When would you use the extend() method over append()?