How do you access the third element of a list named my_list in Python?
-
A
my_list[2]
Correct answer
-
B
my_list[3]
-
C
my_list[1]
-
D
my_list[0]
Correct answer
A. my_list[2]
17 views
Explanation
Python uses zero-based indexing, so the third element of a list can be accessed using my_list[2].
Doubts & discussion
Not sure why the answer is A? Ask here and get an explanation.
Ask a doubt about this MCQ