What does del a[0] do on a list a in Python?
-
A
Deletes the whole list
-
B
Removes the first element
Correct answer
-
C
Sets the first element to None
-
D
Returns the first element
Correct answer
B. Removes the first element
Explanation
del removes the item at the given index.
Doubts & discussion
Not sure why the answer is B? Ask here and get an explanation.
Ask a doubt about this MCQ