What is a sequence in Python?
An object that contains multiple items of data stored one after another (e.g., lists, tuples)
What is the difference between a list and a tuple?
Lists are mutable; tuples are immutable
What is a list?
An object containing multiple data items, called elements, defined with brackets: [item1, item2, …]
What is a repetition operator for lists?
How do you iterate over a list?
With a for loop: for x in list:
What is an index in a list?
A number specifying the position of an element; first element is at index 0
What do negative indexes in lists represent?
Positions relative to the end of the list; -1 is the last element
What does the len() function return for a list?
The number of elements in the list
What happens if you use an invalid index?
An IndexError exception is raised
Are lists mutable?
Yes, list elements can be changed with assignment
How do you concatenate two lists?
Using + or +=
What is list slicing?
Extracting a span of items: list[start:end], up to but not including end
What does the in operator do with lists?
Tests whether an item is in a list; returns True or False
What does the not in operator do with lists?
Tests whether an item is not in a list
What does append(item) do?
Adds an item to the end of a list
What does count(item) do?
Returns the number of times an item appears in a list
What does index(item) do?
Returns the index of the first occurrence of an item; raises ValueError if not found
What does insert(index, item) do?
Inserts an item at a specific index
What does sort() do for lists?
Sorts elements in ascending order
What does remove(item) do?
Removes the first occurrence of an item
What does reverse() do for lists?
Reverses the order of list elements
What does the del statement do for lists?
Removes an element at a specified index: del list[i]
What do sum(), min(), and max() do for lists?
Return the total, the lowest value, and the highest value in a numeric list
How do you properly copy a list?
Create a new list and copy elements using a loop or concatenation