Python lists come with useful methods that let you modify and interact with the list easily.
colors.append("yellow")colors.remove("green")last_color = colors.pop()Slicing lets you get a portion of a list using the format list[start:end]. It returns a new list from index start up to, but not including, end.
Example:
numbers = [10, 20, 30, 40, 50]
subset = numbers[1:4] # returns [20, 30, 40]You can omit start or end:
numbers[:3] gets first three itemsnumbers[2:] gets items from index 2 to the endList methods and slicing help you manipulate data efficiently — selecting rows, cleaning values, or preparing subsets for analysis.